pl.edu.agh.cast.schema.editor.action
Class AlignmentAction

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.jface.action.AbstractAction
          extended by org.eclipse.jface.action.Action
              extended by org.eclipse.gef.ui.actions.WorkbenchPartAction
                  extended by org.eclipse.gef.ui.actions.SelectionAction
                      extended by pl.edu.agh.cast.schema.editor.action.AlignmentAction
All Implemented Interfaces:
org.eclipse.gef.Disposable, org.eclipse.gef.ui.actions.UpdateAction, org.eclipse.jface.action.IAction

public final class AlignmentAction
extends org.eclipse.gef.ui.actions.SelectionAction

Alignment action. This class is copy of AlignmentAction, however because of optimalization purpose it always returns true in calculateEnabled() method.

Author:
AGH CAST Team

Field Summary
static String ID_ALIGN_BOTTOM
          Indicates that the bottom edges should be aligned.
static String ID_ALIGN_CENTER
          Indicates that the horizontal centers should be aligned.
static String ID_ALIGN_LEFT
          Indicates that the left edges should be aligned.
static String ID_ALIGN_MIDDLE
          Indicates that the vertical midpoints should be aligned.
static String ID_ALIGN_RIGHT
          Indicates that the right edges should be aligned.
static String ID_ALIGN_TOP
          Indicates that the top edges should be aligned.
 
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
AlignmentAction(org.eclipse.ui.IWorkbenchPart part, int align)
          Constructs an AlignmentAction with the given part and alignment ID.
 
Method Summary
protected  org.eclipse.draw2d.geometry.Rectangle calculateAlignmentRectangle(org.eclipse.gef.Request request)
          Returns the alignment rectangle to which all selected parts should be aligned.
protected  boolean calculateEnabled()
           
 void dispose()
          
protected  List<org.eclipse.gef.EditPart> getOperationSet(org.eclipse.gef.Request request)
          Returns the list of editparts which will participate in alignment.
protected  void initUI()
          Initializes the actions UI presentation.
 void run()
          
 
Methods inherited from class org.eclipse.gef.ui.actions.SelectionAction
getSelectedObjects, getSelection, handleSelectionChanged, setSelection, setSelectionProvider, update
 
Methods inherited from class org.eclipse.gef.ui.actions.WorkbenchPartAction
execute, getCommandStack, getWorkbenchPart, init, isEnabled, refresh, setLazyEnablementCalculation, 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, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, runWithEvent, 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, removePropertyChangeListener
 

Field Detail

ID_ALIGN_BOTTOM

public static final String ID_ALIGN_BOTTOM
Indicates that the bottom edges should be aligned.

See Also:
Constant Field Values

ID_ALIGN_CENTER

public static final String ID_ALIGN_CENTER
Indicates that the horizontal centers should be aligned.

See Also:
Constant Field Values

ID_ALIGN_LEFT

public static final String ID_ALIGN_LEFT
Indicates that the left edges should be aligned.

See Also:
Constant Field Values

ID_ALIGN_MIDDLE

public static final String ID_ALIGN_MIDDLE
Indicates that the vertical midpoints should be aligned.

See Also:
Constant Field Values

ID_ALIGN_RIGHT

public static final String ID_ALIGN_RIGHT
Indicates that the right edges should be aligned.

See Also:
Constant Field Values

ID_ALIGN_TOP

public static final String ID_ALIGN_TOP
Indicates that the top edges should be aligned.

See Also:
Constant Field Values
Constructor Detail

AlignmentAction

public AlignmentAction(org.eclipse.ui.IWorkbenchPart part,
                       int align)
Constructs an AlignmentAction with the given part and alignment ID. The alignment ID must by one of:

Parameters:
part - the workbench part used to obtain context
align - the aligment ID.
Method Detail

calculateAlignmentRectangle

protected org.eclipse.draw2d.geometry.Rectangle calculateAlignmentRectangle(org.eclipse.gef.Request request)
Returns the alignment rectangle to which all selected parts should be aligned.

Parameters:
request - the alignment Request
Returns:
the alignment rectangle

calculateEnabled

protected boolean calculateEnabled()
Specified by:
calculateEnabled in class org.eclipse.gef.ui.actions.WorkbenchPartAction
See Also:
WorkbenchPartAction.calculateEnabled()

dispose

public void dispose()

Specified by:
dispose in interface org.eclipse.gef.Disposable
Overrides:
dispose in class org.eclipse.gef.ui.actions.SelectionAction
See Also:
SelectionAction.dispose()

getOperationSet

protected List<org.eclipse.gef.EditPart> getOperationSet(org.eclipse.gef.Request request)
Returns the list of editparts which will participate in alignment.

Parameters:
request - the alignment request
Returns:
the list of parts which will be aligned

initUI

protected void initUI()
Initializes the actions UI presentation.


run

public void run()

Specified by:
run in interface org.eclipse.jface.action.IAction
Overrides:
run in class org.eclipse.jface.action.Action
See Also:
Action.run()


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.