Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Runtime

org.eclipse.gmf.runtime.diagram.ui.providers
Class DiagramGlobalActionHandler

java.lang.Object
  extended by 

org.eclipse.gmf.runtime.common.ui.services.action.global.AbstractGlobalActionHandler
      extended by 
org.eclipse.gmf.runtime.diagram.ui.providers.DiagramGlobalActionHandler
All Implemented Interfaces:
IGlobalActionHandler
Direct Known Subclasses:
DiagramWithPrintGlobalActionHandler

public class DiagramGlobalActionHandler
extends AbstractGlobalActionHandler

Class that implements the IGlobalActionHandler interface. Contains behaviour common to GMF diagrams.


Constructor Summary
DiagramGlobalActionHandler ()
          Constructor for DiagramGlobalActionHandler.
 
Method Summary
protected  boolean canCopy ( IGlobalActionContext cntxt)
          Checks if the selected IViews can be copied to the clipboard
protected  boolean canCut ( IGlobalActionContext cntxt)
          Checks if the selected IViews can be cut
 boolean canHandle ( IGlobalActionContext cntxt)
          Return true if the handler can handle the context
protected  boolean canPaste ( IGlobalActionContext cntxt)
          Checks if the paste can occur
protected  boolean canSave ( IGlobalActionContext cntxt)
          Checks if the selected IElements will allow a save.
protected  PasteViewRequest createPasteViewRequest ()
          Creates and returns the appropriate PasteViewRequest that is to be used to get the appropriate paste Command from the EditPart.
  ICommand getCommand ( IGlobalActionContext cntxt)
          Return the ICommand for the context
protected   ICommand getCopyCommand ( IGlobalActionContext cntxt, IDiagramWorkbenchPart diagramPart, boolean isUndoable)
          Returns a command to copy the context's selection to the clipboard.
protected   ICommand getCutCommand ( IGlobalActionContext cntxt, IDiagramWorkbenchPart diagramPart)
          Returns a command to copy the context's selection to the clipboard and to delete it.
protected   IMapMode getMapMode ( IGlobalActionContext cntxt)
          Retrieve the IMapMode object from the DiagramRootEditPart
protected  java.util.List getSelectedViews ( ISelection sel)
          Returns the selected View objects, only if the selection is an IStructuredSelection. and only the View object of an INodeEditPart or a ShapeEditPart
protected  void selectAddedObject ( EditPartViewer viewer, java.util.Collection objects)
          Select the newly added shape view by default.
 
Methods inherited from class org.eclipse.gmf.runtime.common.ui.services.action.global. AbstractGlobalActionHandler
getLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiagramGlobalActionHandler

public DiagramGlobalActionHandler()
Constructor for DiagramGlobalActionHandler.

Method Detail

getCommand

public 
ICommand getCommand(
IGlobalActionContext cntxt)
Description copied from interface: IGlobalActionHandler
Return the ICommand for the context

Parameters:
cntxt - The context
Returns:
ICommand

getCopyCommand

protected 
ICommand getCopyCommand(
IGlobalActionContext cntxt,
                                  IDiagramWorkbenchPart diagramPart,
                                  boolean isUndoable)
Returns a command to copy the context's selection to the clipboard.

Parameters:
cntxt - the IGlobalActionContext from which the label and selection are retrieved.
diagramPart - the IDiagramWorkbenchPart from which the diagram is retrieved.
isUndoable - true if this command should be undoable/redoable; false otherwise
Returns:
the copy command

getCutCommand

protected 
ICommand getCutCommand(
IGlobalActionContext cntxt,
                                 IDiagramWorkbenchPart diagramPart)
Returns a command to copy the context's selection to the clipboard and to delete it.

Parameters:
cntxt - the IGlobalActionContext from which the label and selection are retrieved.
diagramPart - the IDiagramWorkbenchPart from which the diagram is retrieved.
Returns:
the cut command

createPasteViewRequest

protected PasteViewRequest createPasteViewRequest()
Creates and returns the appropriate PasteViewRequest that is to be used to get the appropriate paste Command from the EditPart. The returned PasteViewRequest contains data from the clipboard

Returns:
PasteViewRequest

getSelectedViews

protected java.util.List getSelectedViews(
ISelection sel)
Returns the selected View objects, only if the selection is an IStructuredSelection. and only the View object of an INodeEditPart or a ShapeEditPart

Parameters:
sel - the selection from which to extract the View objects
Returns:
List the selected View. Could be empty if the selection doesn't contain proper edit parts, or, could be the original if the selection is not an IStructuredSelection

canCopy

protected boolean canCopy(
IGlobalActionContext cntxt)
Checks if the selected IViews can be copied to the clipboard

Parameters:
cntxt - the IGlobalActionContext holding the necessary information needed by this action handler
Returns:
boolean indicating the enablement of the copy action

canCut

protected boolean canCut(
IGlobalActionContext cntxt)
Checks if the selected IViews can be cut

Parameters:
cntxt - the IGlobalActionContext holding the necessary information needed by this action handler
Returns:
boolean indicating the enablement of the cut action

canPaste

protected boolean canPaste(
IGlobalActionContext cntxt)
Checks if the paste can occur

Parameters:
cntxt - the IGlobalActionContext holding the necessary information needed by this action handler
Returns:
boolean indicating the enablement of the paste action

canSave

protected boolean canSave(
IGlobalActionContext cntxt)
Checks if the selected IElements will allow a save. Save should only be enabled when no shapes are selected to avoid clutter on the context menu and if the editor is dirty.

Parameters:
cntxt - the IGlobalActionContext holding the necessary information needed by this action handler
Returns:
boolean indicating the enablement of the save action

canHandle

public boolean canHandle(
IGlobalActionContext cntxt)
Description copied from interface: IGlobalActionHandler
Return true if the handler can handle the context

Parameters:
cntxt - The context
Returns:
boolean

selectAddedObject

protected void selectAddedObject(
EditPartViewer viewer,
                                 java.util.Collection objects)
Select the newly added shape view by default.

Parameters:
viewer - the viewer owning the edit parts to be selected
objects - the collection of object from which to extract the EditPart to select

getMapMode

protected 
IMapMode getMapMode(
IGlobalActionContext cntxt)
Retrieve the IMapMode object from the DiagramRootEditPart

Parameters:
cntxt - the IGlobalActionContext holding the necessary information needed by this action handler
Returns:
IMapMode object that performs coordinate mapping from device to logical. Returns null if the context isn't valid.

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire