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 SummaryFields inherited from interface org.eclipse.jface.action.IActionAS_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 SummaryConstructorsModifierConstructorDescriptionprotectedCreates aSelectionActionand associates it with the given workbench part.protectedSelectionAction(IWorkbenchPart part, int style) Creates aSelectionActionand associates it with the given editor.
- 
Method SummaryModifier and TypeMethodDescriptionvoiddispose()Disposes the action when it is no longer needed.Returns aList<EditPartcontaining the currently selected EditParts.Returns aList<EditPartcontaining the currently selected objects.protected ISelectionGets the current selection.protected voidCalled when the selection is changed.protected voidsetSelection(ISelection selection) Sets the current selection and calls on subclasses to handle the selectionChanged event.voidsetSelectionProvider(ISelectionProvider provider) May be used to provide an alternative selection source other than the workbench's selection service.voidupdate()Called to update the receiver.Methods inherited from class org.eclipse.gef.ui.actions.WorkbenchPartActioncalculateEnabled, execute, getCommandStack, getWorkbenchPart, init, isEnabled, refresh, setLazyEnablementCalculation, setWorkbenchPartMethods inherited from class org.eclipse.jface.action.ActionconvertAccelerator, 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, setToolTipTextMethods inherited from class org.eclipse.jface.action.AbstractActionaddPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListenerMethods inherited from class org.eclipse.core.commands.common.EventManageraddListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
- 
Constructor Details- 
SelectionActionCreates aSelectionActionand associates it with the given editor.- Parameters:
- part- The workbench part associated with this action
- style- the style for this action
 
- 
SelectionActionCreates aSelectionActionand associates it with the given workbench part.- Parameters:
- part- the workbench part
 
 
- 
- 
Method Details- 
disposepublic void dispose()Description copied from class:WorkbenchPartActionDisposes the action when it is no longer needed.- Specified by:
- disposein interface- Disposable
- Overrides:
- disposein class- WorkbenchPartAction
- See Also:
 
- 
getSelectedObjectsReturns aList<EditPartcontaining the currently selected objects. Thesetmethod is supported but theadd,addAll,removeremoveAllmethods are not. Changes to this list modify the internalselection.- Returns:
- A List containing the currently selected objects.
 
- 
getSelectedEditPartsReturns aList<EditPartcontaining the currently selected EditParts. If elements not of type EditPart are selected, an empty list is returned. Thesetmethod is supported but theadd,addAll,removeremoveAllmethods are not. Changes to this list modify the internalselection.
 Note: This method only checks whether the first selected element is of typeEditPartand then performs a lazy cast fromList<?>toList<EditPart>. It should therefore only be called when a single type of objects are selected.- Returns:
- A List containing the currently selected EditParts.
- Since:
- 3.20
 
- 
getSelectionGets the current selection.- Returns:
- The current selection.
 
- 
handleSelectionChangedprotected void handleSelectionChanged()Called when the selection is changed.
- 
setSelectionSets the current selection and calls on subclasses to handle the selectionChanged event.- Parameters:
- selection- The new selection.
 
- 
setSelectionProviderMay 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-- nullor a selection provider
 
- 
updatepublic void update()Description copied from interface:UpdateActionCalled to update the receiver.- Specified by:
- updatein interface- UpdateAction
- Overrides:
- updatein class- WorkbenchPartAction
- See Also:
 
 
-