org.eclipse.gef.ui.actions
Class SelectionAction
java.lang.Object
|
+--org.eclipse.jface.action.Action
|
+--org.eclipse.gef.ui.actions.EditorPartAction
|
+--org.eclipse.gef.ui.actions.SelectionAction
- All Implemented Interfaces:
- Disposable, IAction, ISelectionListener
- Direct Known Subclasses:
- AlignmentAction, DeleteAction, DirectEditAction
- public abstract class SelectionAction
- extends EditorPartAction
- implements ISelectionListener
Superclass for an action needing the current selection.
| Methods inherited from class org.eclipse.jface.action.Action |
addPropertyChangeListener, convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, firePropertyChange, firePropertyChange, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, removeAcceleratorText, removePropertyChangeListener, run, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SelectionAction
public SelectionAction(IEditorPart editor,
int style)
- Creates a
SelectionAction and associates it with the
given editor.
- Parameters:
editor - The editor that this action is associated with.style - The style bitmask.
SelectionAction
public SelectionAction(IEditorPart editor)
- Creates a
SelectionAction and associates it with the
given editor.
- Parameters:
editor - The editor that this action is associated with.
dispose
public void dispose()
- Description copied from class:
EditorPartAction
- Called when the action is about to be disposed. Subclasses
should override
EditorPartAction.unhookEditorPart() instead of this
method to perform any final clean-up.
- Overrides:
dispose in class EditorPartAction
getSelection
protected ISelection getSelection()
- Gets the current selection.
- Returns:
- The current selection.
getSelectedObjects
protected List getSelectedObjects()
- Returns a
List containing the currently
selected objects.
- Returns:
- A List containing the currently selected objects.
handleSelectionChanged
protected void handleSelectionChanged()
hookEditorPart
protected void hookEditorPart()
- Add this action as a
ISelectionListener to
the selection service.
- Overrides:
hookEditorPart in class EditorPartAction
selectionChanged
public void selectionChanged(IWorkbenchPart part,
ISelection selection)
- Updates the enable state depending on the current selection.
The default is to enable of one item is selected. Override
this in subclass if needed.
- Specified by:
selectionChanged in interface ISelectionListener
- Parameters:
part - The workbench.selection - The new selection.
setSelection
protected void setSelection(ISelection selection)
- Sets the current selection and calls on subclasses
to handle the selectionChanged event.
- Parameters:
selection - The new selection.
unhookEditorPart
protected void unhookEditorPart()
- Removes this selection listener from the selection service.
- Overrides:
unhookEditorPart in class EditorPartAction