Runtime

org.eclipse.gmf.runtime.diagram.ui.render.actions
Class CopyToImageAction

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.render.actions.CopyToImageAction
All Implemented Interfaces:
Disposable, IAction, IActionWithProgress, IDisposableAction, IOperationHistoryListener, IPropertyListener, ISelectionChangedListener

public class CopyToImageAction
extends DiagramAction

Action to copy the selected shapes in the diagram or the entire diagram to an image file.


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
CopyToImageAction(IWorkbenchPage page)
          Constructor for CopyToImageAction.
 
Method Summary
protected  boolean calculateEnabled()
          Calculates the enblement state of the action
protected  java.util.List createOperationSet()
          Filters the selected objects and returns only editparts that understands the request
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.
protected  CopyToImageUtil getCopyToImageUtil()
          Subclasses may override to specialize the rendering to an image file.
 void init()
          Initialize with the correct text label, action id, and images.
protected  boolean isSelectionListener()
          Does this action need to listen to selection change events?
 void run()
           
 
Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction
clearTargetRequest, dispose, execute, filterEditPartsMatching, getCommand, getCommand, getCommandLabel, getDiagramCommandStack, getDiagramEditDomain, getDiagramEditPart, getDiagramGraphicalViewer, getDiagramWorkbenchPart, getOperationSet, getPreferencesHint, getSelectedObjects, getTargetEditParts, getTargetRequest, refresh, 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, 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

CopyToImageAction

public CopyToImageAction(IWorkbenchPage page)
Constructor for CopyToImageAction.

Parameters:
page - the page of the workbench for the action
Method Detail

init

public void init()
Initialize with the correct text label, action id, and images.

Specified by:
init in interface IDisposableAction
Overrides:
init in class AbstractActionHandler

run

public void run()
Specified by:
run in interface IAction
Overrides:
run in class AbstractActionHandler

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

createOperationSet

protected java.util.List createOperationSet()
Description copied from class: DiagramAction
Filters the selected objects and returns only editparts that understands the request

Overrides:
createOperationSet in class DiagramAction
Returns:
a list of editparts selected.

isSelectionListener

protected boolean isSelectionListener()
Description copied from class: DiagramAction
Does this action need to listen to selection change events? If the enablement state of the context menu or the operation set depends on what is selected in a diagram, then this needs to return true. If this action targets the diagram only, then it should return false.

Actions that are only contributed to the popup menu (and not toolbar or main menus) will not receive selection events at all. The refresh() method will be called when the context menu is about to show.

Specified by:
isSelectionListener in class DiagramAction

createTargetRequest

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

Specified by:
createTargetRequest in class DiagramAction
Returns:
the new target request

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

getCopyToImageUtil

protected CopyToImageUtil getCopyToImageUtil()
Subclasses may override to specialize the rendering to an image file.

Returns:
the CopyToImageUtil class to be used.

Runtime

Guidelines for using Eclipse APIs.

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