Package org.eclipse.gef.ui.actions
Class SelectionAction
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.jface.action.AbstractAction
org.eclipse.jface.action.Action
org.eclipse.gef.ui.actions.WorkbenchPartAction
org.eclipse.gef.ui.actions.SelectionAction
- All Implemented Interfaces:
Disposable
,UpdateAction
,IAction
- Direct Known Subclasses:
AlignmentAction
,DeleteAction
,DirectEditAction
,MatchSizeAction
,PasteTemplateAction
Superclass for an action needing the current selection.
-
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
ConstructorsConstructorDescriptionCreates aSelectionAction
and associates it with the given workbench part.SelectionAction
(IWorkbenchPart part, int style) Creates aSelectionAction
and associates it with the given editor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Disposes the action when it is no longer needed.protected List
Returns aList
containing the currently selected objects.protected ISelection
Gets the current selection.protected void
Called when the selection is changed.protected void
setSelection
(ISelection selection) Sets the current selection and calls on subclasses to handle the selectionChanged event.void
setSelectionProvider
(ISelectionProvider provider) May be used to provide an alternative selection source other than the workbench's selection service.void
update()
Called to update the receiver.Methods inherited from class org.eclipse.gef.ui.actions.WorkbenchPartAction
calculateEnabled, 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, run, 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
-
Constructor Details
-
SelectionAction
Creates aSelectionAction
and associates it with the given editor.- Parameters:
part
- The workbench part associated with this actionstyle
- the style for this action
-
SelectionAction
Creates aSelectionAction
and associates it with the given workbench part.- Parameters:
part
- the workbench part
-
-
Method Details
-
dispose
public void dispose()Description copied from class:WorkbenchPartAction
Disposes the action when it is no longer needed.- Specified by:
dispose
in interfaceDisposable
- Overrides:
dispose
in classWorkbenchPartAction
- See Also:
-
getSelectedObjects
Returns aList
containing the currently selected objects.- Returns:
- A List containing the currently selected objects.
-
getSelection
Gets the current selection.- Returns:
- The current selection.
-
handleSelectionChanged
protected void handleSelectionChanged()Called when the selection is changed. -
setSelection
Sets the current selection and calls on subclasses to handle the selectionChanged event.- Parameters:
selection
- The new selection.
-
setSelectionProvider
May be used to provide an alternative selection source other than the workbench's selection service. Use of this method is optional. The default value isnull
, in which case the selection is obtained using the partsite's selection service.- Parameters:
provider
-null
or a selection provider
-
update
public void update()Description copied from interface:UpdateAction
Called to update the receiver.- Specified by:
update
in interfaceUpdateAction
- Overrides:
update
in classWorkbenchPartAction
- See Also:
-