| org.eclipse.ui.actions.BaseSelectionListenerAction
All known Subclasses: org.eclipse.ui.actions.ExportResourcesAction, org.eclipse.ui.actions.ImportResourcesAction,
BaseSelectionListenerAction | abstract public class BaseSelectionListenerAction extends Action implements ISelectionChangedListener(Code) | | The abstract superclass for actions that listen to selection change events.
This implementation tracks the current selection (see
getStructuredSelection ) and provides a convenient place to
monitor selection changes that could affect the availability of the action.
Subclasses must implement the following IAction method:
run - to do the action's work
Subclasses may extend the updateSelection method to update
the action determine its availability based on the current selection.
The object instantiating the subclass is responsible for registering
the instance with a selection provider. Alternatively, the object can
notify the subclass instance directly of a selection change using the
methods:
selectionChanged(IStructuredSelection) - passing the selection
selectionChanged(ISelectionChangedEvent) - passing the selection change event
since: 3.0 |
Method Summary | |
protected void | clearCache() Clears any cached state associated with the selection.
Called when the selection changes.
The BaseSelectionListenerAction implementation of this method
does nothing. | public IStructuredSelection | getStructuredSelection() Returns the current structured selection in the workbench, or an empty
selection if nothing is selected or if selection does not include
objects (for example, raw text). | public void | runWithEvent(Event event) | final public void | selectionChanged(IStructuredSelection selection) Notifies this action that the given structured selection has changed.
The BaseSelectionListenerAction implementation of this method
records the given selection for future reference and calls
updateSelection , updating the enable state of this action
based on the outcome. | final public void | selectionChanged(SelectionChangedEvent event) The BaseSelectionListenerAction implementation of this
ISelectionChangedListener method calls
selectionChanged(IStructuredSelection) assuming the selection is
a structured one. | protected boolean | updateSelection(IStructuredSelection selection) Updates this action in response to the given selection.
The BaseSelectionListenerAction implementation of this method
returns true . |
BaseSelectionListenerAction | protected BaseSelectionListenerAction(String text)(Code) | | Creates a new action with the given text.
Parameters: text - the string used as the text for the action, or null if there is no text |
clearCache | protected void clearCache()(Code) | | Clears any cached state associated with the selection.
Called when the selection changes.
The BaseSelectionListenerAction implementation of this method
does nothing. Subclasses may override.
|
getStructuredSelection | public IStructuredSelection getStructuredSelection()(Code) | | Returns the current structured selection in the workbench, or an empty
selection if nothing is selected or if selection does not include
objects (for example, raw text).
the current structured selection in the workbench |
runWithEvent | public void runWithEvent(Event event)(Code) | | |
selectionChanged | final public void selectionChanged(IStructuredSelection selection)(Code) | | Notifies this action that the given structured selection has changed.
The BaseSelectionListenerAction implementation of this method
records the given selection for future reference and calls
updateSelection , updating the enable state of this action
based on the outcome. Subclasses should override updateSelection
to react to selection changes.
Parameters: selection - the new selection |
selectionChanged | final public void selectionChanged(SelectionChangedEvent event)(Code) | | The BaseSelectionListenerAction implementation of this
ISelectionChangedListener method calls
selectionChanged(IStructuredSelection) assuming the selection is
a structured one. Subclasses should override the updateSelection
method to react to selection changes.
|
updateSelection | protected boolean updateSelection(IStructuredSelection selection)(Code) | | Updates this action in response to the given selection.
The BaseSelectionListenerAction implementation of this method
returns true . Subclasses may extend to react to selection
changes; however, if the super method returns false , the
overriding method must also return false .
Parameters: selection - the new selection true if the action should be enabled for this selection,and false otherwise |
|
|