Runtime

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

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

public class AlignAction
extends DiagramAction

See Also:
actions.AlignmentAction

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
AlignAction(IWorkbenchPage workbenchPage, java.lang.String id, int align)
          Constructs an AlignAction with the given part and alignment ID.
AlignAction(IWorkbenchPage workbenchPage, java.lang.String id, int align, boolean isToolbarItem)
          Constructs an AlignAction with the given part and alignment ID.
 
Method Summary
protected  Rectangle calculateAlignmentRectangle()
          Returns the alignment rectangle to which all selected parts should be aligned.
protected  java.util.List createOperationSet()
          Filters the selected objects and returns only editparts that understands the request
protected  Request createTargetRequest()
          Creates a new target request
protected  void initUI()
          Initializes the actions UI presentation.
protected  boolean isOperationHistoryListener()
          Retrieves a Boolean indicating whether this action handler is interested in operation history changed events.
protected  boolean isSelectionListener()
          Does this action need to listen to selection change events?
protected  void updateTargetRequest()
          updates the target request.
 
Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction
calculateEnabled, clearTargetRequest, dispose, doRun, execute, filterEditPartsMatching, getCommand, getCommand, getCommandLabel, getDiagramCommandStack, getDiagramEditDomain, getDiagramEditPart, getDiagramGraphicalViewer, getDiagramWorkbenchPart, getOperationSet, getPreferencesHint, getSelectedObjects, getTargetEditParts, getTargetRequest, refresh, setTargetRequest
 
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, init, isDisposed, 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

AlignAction

public AlignAction(IWorkbenchPage workbenchPage,
                   java.lang.String id,
                   int align)
Constructs an AlignAction with the given part and alignment ID. The alignment ID must by one of:

Parameters:
id - the action ID.
align - the aligment ID.

AlignAction

public AlignAction(IWorkbenchPage workbenchPage,
                   java.lang.String id,
                   int align,
                   boolean isToolbarItem)
Constructs an AlignAction with the given part and alignment ID. The alignment ID must by one of:

Parameters:
id - the action ID.
align - the aligment ID.
isToolbarItem - the indicator of whether or not this is a toolbar action -as opposed to a context-menu action.
Method Detail

initUI

protected void initUI()
Initializes the actions UI presentation. Two sets of each align action are required. One for the toolbar, and one for other menus. The toolbar action has explicit text, the other menus do not. For example: Align Left and Left.


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

isOperationHistoryListener

protected boolean isOperationHistoryListener()
Description copied from class: AbstractActionHandler
Retrieves a Boolean indicating whether this action handler is interested in operation history changed events.

Overrides:
isOperationHistoryListener in class AbstractActionHandler
Returns:
true if this action handler is interested; 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.

createTargetRequest

protected Request createTargetRequest()
Description copied from class: DiagramAction
Creates a new target request

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

updateTargetRequest

protected void updateTargetRequest()
Description copied from class: DiagramAction
updates the target request. Clients should call this method whenever the request is expected to be changed

Overrides:
updateTargetRequest in class DiagramAction

calculateAlignmentRectangle

protected Rectangle calculateAlignmentRectangle()
Returns the alignment rectangle to which all selected parts should be aligned.

Returns:
the alignment rectangle

Runtime

Guidelines for using Eclipse APIs.

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