public abstract class SelectionProviderAction extends Action implements ISelectionChangedListener
Subclasses must implement the following IAction
method:
run
- to do the action's workSubclasses may reimplement either of the following methods:
selectionChanged(IStructuredSelection)
selectionChanged(ISelection)
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
Modifier | Constructor and Description |
---|---|
protected |
SelectionProviderAction(ISelectionProvider provider,
String text)
Creates a new action with the given text that monitors selection changes
within the given selection provider.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes this action by removing it as a listener from the selection provider.
|
ISelection |
getSelection()
Returns the current selection in the selection provider.
|
ISelectionProvider |
getSelectionProvider()
Returns the selection provider that is the target of this action.
|
IStructuredSelection |
getStructuredSelection()
Returns the current structured selection in the selection provider, or an
empty selection if nothing is selected or if selection does not include
objects (for example, raw text).
|
void |
selectionChanged(ISelection selection)
Notifies this action that the given (non-structured) selection has changed
in the selection provider.
|
void |
selectionChanged(IStructuredSelection selection)
Notifies this action that the given structured selection has changed
in the selection provider.
|
void |
selectionChanged(SelectionChangedEvent event)
The
SelectionProviderAction implementation of this
ISelectionChangedListener method calls
selectionChanged(IStructuredSelection) if the selection is
a structured selection but selectionChanged(ISelection) if it is
not. |
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, run, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
protected SelectionProviderAction(ISelectionProvider provider, String text)
provider
- the selection provider that will provide selection notificationtext
- the string used as the text for the action,
or null
if there is no textpublic void dispose()
public ISelection getSelection()
public ISelectionProvider getSelectionProvider()
public IStructuredSelection getStructuredSelection()
public void selectionChanged(ISelection selection)
The SelectionProviderAction
implementation of this method
does nothing. Subclasses may reimplement to react to this selection change.
selection
- the new selectionpublic void selectionChanged(IStructuredSelection selection)
The SelectionProviderAction
implementation of this method
does nothing. Subclasses may reimplement to react to this selection change.
selection
- the new selectionpublic final void selectionChanged(SelectionChangedEvent event)
SelectionProviderAction
implementation of this
ISelectionChangedListener
method calls
selectionChanged(IStructuredSelection)
if the selection is
a structured selection but selectionChanged(ISelection)
if it is
not. Subclasses should override either of those methods method to react to
selection changes.selectionChanged
in interface ISelectionChangedListener
event
- event object describing the change
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.