Runtime

org.eclipse.gmf.runtime.diagram.ui.actions
Class CopyAction

java.lang.Object
  extended byorg.eclipse.core.commands.common.EventManager
      extended byorg.eclipse.jface.action.AbstractAction
          extended byorg.eclipse.jface.action.Action
              extended byorg.eclipse.gmf.runtime.common.ui.action.AbstractActionHandler
                  extended byorg.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction
                      extended byorg.eclipse.gmf.runtime.diagram.ui.actions.CopyAction
All Implemented Interfaces:
Disposable, IAction, IActionWithProgress, IDisposableAction, IOperationHistoryListener, IPropertyListener, ISelectionChangedListener

public abstract class CopyAction
extends DiagramAction

The copy action that copies the bitmap information on to the clipboard This action is not really a DiagramAction as it doesn't have a request. The doRun() and the refresh() and calculatedEnabled() have been overwritten appropriately.


Nested Class Summary
 
Nested classes inherited from class org.eclipse.gmf.runtime.common.ui.action.IActionWithProgress
IActionWithProgress.WorkIndicatorType
 
Field Summary
 
Fields inherited from interface org.eclipse.jface.action.IAction
AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT
 
Constructor Summary
CopyAction(IWorkbenchPage page)
          Constructor
 
Method Summary
protected  boolean calculateEnabled()
          Calculates the enblement state of the action
protected  boolean canCopy(java.util.List parts)
          If this list of parts contains a ShapeEditPart, return true, otherwise false.
protected  Request createTargetRequest()
          This action is not really a DiagramAction as it doesn't have a request.
protected  void doRun(IProgressMonitor progressMonitor)
          Performs the actual work when this action handler is run.
 void init()
          initialize with the correct images and action id
protected  boolean isCopyAll()
          If the selected object is a DiagramEditPart, return true, otherwise return false.
protected  boolean isSelectionListener()
          return true so this action cares about selection changes
 void refresh()
          Refresh the enablement status based on whether the action is enabled or not.
 
Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction
clearTargetRequest, createOperationSet, dispose, execute, filterEditPartsMatching, getCommand, getCommand, getCommandLabel, getDiagramCommandStack, getDiagramEditDomain, getDiagramEditPart, getDiagramGraphicalViewer, getDiagramWorkbenchPart, getOperationSet, getPreferencesHint, getSelectedObjects, getTargetEditParts, getTargetRequest, setTargetRequest, updateTargetRequest
 
Methods inherited from class org.eclipse.gmf.runtime.common.ui.action.AbstractActionHandler
contributedToPart, getActionManager, getLabel, getOperationHistory, getPartListener, getSelection, getStructuredSelection, getUndoContext, getWorkbenchPage, getWorkbenchPart, getWorkIndicatorType, handle, historyNotification, isDisposed, isOperationHistoryListener, isPropertyListener, isRunnable, isSetup, needsSetup, openErrorDialog, propertyChanged, run, run, runWithEvent, selectionChanged, setDisposed, setPartSelector, setSetup, setup, setWorkbenchPart
 
Methods inherited from class org.eclipse.jface.action.Action
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 
Methods inherited from class org.eclipse.jface.action.AbstractAction
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.action.IAction
addPropertyChangeListener, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, removePropertyChangeListener, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 

Constructor Detail

CopyAction

public CopyAction(IWorkbenchPage page)
Constructor

Parameters:
page - the active workbenchpage
Method Detail

init

public void init()
initialize with the correct images and action id

Specified by:
init in interface IDisposableAction
Overrides:
init in class AbstractActionHandler
See Also:
IDisposableAction.init()

calculateEnabled

protected boolean calculateEnabled()
Description copied from class: DiagramAction
Calculates the enblement state of the action

Overrides:
calculateEnabled in class DiagramAction
Returns:
true if action should be enabled, false otherwise

isCopyAll

protected boolean isCopyAll()
If the selected object is a DiagramEditPart, return true, otherwise return false. If the selected object is a DiagramEditPart, the diagram is selected, and all the diagram parts are copied.

Returns:
boolean answering whether to copy all selected objects or not

canCopy

protected boolean canCopy(java.util.List parts)
If this list of parts contains a ShapeEditPart, return true, otherwise false. Copy feature enabled only if at at least one non-connection is selected.

Parameters:
parts - the parts to check
Returns:
boolean answering whether it is OK to copy the passed parts or not

isSelectionListener

protected boolean isSelectionListener()
return true so this action cares about selection changes

Specified by:
isSelectionListener in class DiagramAction
See Also:
AbstractActionHandler.isSelectionListener()

createTargetRequest

protected Request createTargetRequest()
This action is not really a DiagramAction as it doesn't have a request. The doRun() and the refresh() and calculatedEnabled() have been overwritten appropriately.

Specified by:
createTargetRequest in class DiagramAction
Returns:
the new target request
See Also:
DiagramAction.createTargetRequest()

doRun

protected void doRun(IProgressMonitor progressMonitor)
Description copied from class: AbstractActionHandler
Performs the actual work when this action handler is run. Subclasses must override this method to do some work.

Overrides:
doRun in class DiagramAction

refresh

public void refresh()
Refresh the enablement status based on whether the action is enabled or not.

Specified by:
refresh in interface IActionWithProgress
Overrides:
refresh in class DiagramAction
See Also:
IActionWithProgress.refresh()

Runtime

Guidelines for using Eclipse APIs.

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