Interface IAction
- All Known Subinterfaces:
- ActionFactory.IWorkbenchAction
- All Known Implementing Classes:
- AbstractAction,- AbstractTextEditor.LineEndAction,- AbstractTextEditor.LineStartAction,- Action,- AddBookmarkAction,- AddMarkerAction,- AddMemoryRenderingActionDelegate,- AddTaskAction,- AddTaskAction,- BackAction,- BaseSelectionListenerAction,- BooleanPropertyAction,- BuildAction,- CaseAction,- ChangeCompareFilterPropertyAction,- ChangeEncodingAction,- ChangePropertyAction,- ClearOutputAction,- CloseAllSavedAction,- CloseConsoleAction,- CloseResourceAction,- CloseUnrelatedProjectsAction,- org.eclipse.ui.internal.actions.CommandAction,- ContentAssistAction,- ContributedAction,- ConvertLineDelimitersAction,- CopyProjectAction,- CopyResourceAction,- CreateFileAction,- CreateFolderAction,- DebugCommandAction,- DeleteLineAction,- DeleteResourceAction,- EditorPluginAction,- ExportResourcesAction,- FileBufferOperationAction,- FindNextAction,- FindReplaceAction,- ForwardAction,- FrameAction,- GlobalBuildAction,- GoIntoAction,- GotoAnnotationAction,- GotoLastEditPositionAction,- GotoLineAction,- GotoNextEditPositionAction,- ImportResourcesAction,- IncrementalFindAction,- InsertLineAction,- JoinLinesAction,- LabelRetargetAction,- LaunchAction,- LaunchAsAction,- LaunchShortcutsAction,- MarkAction,- MarkerRulerAction,- MarkerRulerInfoAction,- MergeViewerAction,- ModelParticipantAction,- MoveLinesAction,- MoveProjectAction,- MoveResourceAction,- NavigationAction,- NavigationHistoryAction,- NewExampleAction,- NewProjectAction,- NewWizardAction,- NewWizardDropDownAction,- ObjectPluginAction,- OpenCheatSheetAction,- OpenFileAction,- OpenInNewWindowAction,- OpenLaunchDialogAction,- OpenPerspectiveAction,- OpenPreferencesAction,- OpenResourceAction,- OpenSystemEditorAction,- OperationHistoryActionHandler,- PageEventAction,- PartEventAction,- PartPluginAction,- PerspectiveAction,- PinPropertySheetAction,- PluginAction,- PropertyDialogAction,- QuickStartAction,- RecenterAction,- RedoActionHandler,- RefreshAction,- RenameResourceAction,- ResourceAction,- RetargetAction,- RetargetTextEditorAction,- RevertToSavedAction,- RulerBreakpointAction,- RunToLineAction,- SaveAction,- ScrubLocalAction,- SelectAnnotationRulerAction,- SelectionListenerAction,- SelectionProviderAction,- SelectMarkerRulerAction,- SelectMarkerRulerInfoAction,- ShiftAction,- ShowWhitespaceAction,- ShowWhitespaceCharactersAction,- SynchronizeModelAction,- TextEditorAction,- TextEditorPropertyAction,- TextNavigationAction,- TextOperationAction,- TextViewerAction,- TextViewerGotoLineAction,- ToggleBreakpointAction,- ToggleEditorsVisibilityAction,- UndoActionHandler,- UpAction,- ViewPluginAction,- ViewPreferencesAction,- WorkspaceAction,- WWinPluginAction,- WWinPluginPulldown
run
 method is invoked to do the real work.
 Actions support a predefined set of properties (and possibly others as well). Clients of an action may register property change listeners so that they get notified whenever the value of a property changes.
 Clients should subclass the abstract base class Action to define
 concrete actions rather than implementing IAction from scratch.
 
This interface exists only to define the API for actions. It is not intended to be implemented by clients.
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intAction style constant (value2) indicating action is a check box (or a toggle button).static final intAction style constant (value4) indicating action is a drop down menu.static final intAction style constant (value1) indicating action is a simple push button.static final intAction style constant (value8) indicating action is a radio button.static final intAction style constant (value0) indicating action style is not specified yet.static final StringProperty name of an action's checked status (value"checked").static final StringProperty name of an action's description (value"description").static final StringProperty name of an action's enabled state (value"enabled").static final StringProperty name of an action's handler.static final StringProperty name of an action's image (value"image").static final StringProperty name of an action's success/fail result (value"result").static final StringProperty name of an action's text (value"text").static final StringProperty name of an action's tooltip text (value"toolTipText").
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds a property change listener to this action.intReturns the accelerator keycode for this action.Returns the action definition id of this action.Returns the action's description if it has one.Returns the disabled image for this action as an image descriptor.Returns a help listener for this action.Returns the hover image for this action as an image descriptor.getId()Returns a unique identifier for this action, ornullif it has none.Returns the image for this action as an image descriptor.Returns the menu creator for this action.intgetStyle()Return this action's style.getText()Returns the text for this action.Returns the tool tip text for this action.booleanReturns the checked status of this action.booleanReturns whether this action is enabled.booleanReturns whether this action is handled.voidRemoves the given listener from this action.voidrun()Runs this action.voidrunWithEvent(Event event) Runs this action, passing the triggering SWT event.voidsetAccelerator(int keycode) Sets the accelerator keycode that this action maps to.voidSets the action definition id of this action.voidsetChecked(boolean checked) Sets the checked status of this action.voidsetDescription(String text) Sets this action's description.voidsetDisabledImageDescriptor(ImageDescriptor newImage) Sets the disabled image for this action, as an image descriptor.voidsetEnabled(boolean enabled) Sets the enabled state of this action.voidsetHelpListener(HelpListener listener) Sets a help listener for this action.voidsetHoverImageDescriptor(ImageDescriptor newImage) Sets the hover image for this action, as an image descriptor.voidSets the unique identifier for this action.voidsetImageDescriptor(ImageDescriptor newImage) Sets the image for this action, as an image descriptor.voidsetMenuCreator(IMenuCreator creator) Sets the menu creator for this action.voidSets the text for this action.voidsetToolTipText(String text) Sets the tool tip text for this action.
- 
Field Details- 
AS_UNSPECIFIEDstatic final int AS_UNSPECIFIEDAction style constant (value0) indicating action style is not specified yet. By default, the action will assume a push button style. IfsetCheckedis called, then the style will change to a check box, or ifsetMenuCreatoris called, then the style will change to a drop down menu.- Since:
- 2.1
- See Also:
 
- 
AS_PUSH_BUTTONstatic final int AS_PUSH_BUTTONAction style constant (value1) indicating action is a simple push button.- See Also:
 
- 
AS_CHECK_BOXstatic final int AS_CHECK_BOXAction style constant (value2) indicating action is a check box (or a toggle button).Note: The action is also run when a check box gets deselected. Use isChecked()to determine the selection state.- See Also:
 
- 
AS_DROP_DOWN_MENUstatic final int AS_DROP_DOWN_MENUAction style constant (value4) indicating action is a drop down menu.- See Also:
 
- 
AS_RADIO_BUTTONstatic final int AS_RADIO_BUTTONAction style constant (value8) indicating action is a radio button.Note: When a radio button gets selected, the action for the unselected radio button will also be run. Use isChecked()to determine the selection state.- Since:
- 2.1
- See Also:
 
- 
TEXTProperty name of an action's text (value"text").- See Also:
 
- 
ENABLEDProperty name of an action's enabled state (value"enabled").- See Also:
 
- 
IMAGEProperty name of an action's image (value"image").- See Also:
 
- 
TOOL_TIP_TEXTProperty name of an action's tooltip text (value"toolTipText").- See Also:
 
- 
DESCRIPTIONProperty name of an action's description (value"description"). Typically the description is shown as a (longer) help text in the status line.- See Also:
 
- 
CHECKEDProperty name of an action's checked status (value"checked"). Applicable when the style isAS_CHECK_BOXorAS_RADIO_BUTTON.- See Also:
 
- 
RESULTProperty name of an action's success/fail result (value"result"). The values areBoolean.TRUEif running the action succeeded andBoolean.FALSEif running the action failed or did not complete.Not all actions report whether they succeed or fail. This property is provided for use by actions that may be invoked by clients that can take advantage of this information when present (for example, actions used in cheat sheets). Clients should always assume that running the action succeeded in the absence of notification to the contrary. - Since:
- 3.0
- See Also:
 
- 
HANDLEDProperty name of an action's handler. Some actions delegate some or all of their behaviour or state to another object. In this case, if the object to which behaviour has been delegated changes, then a property change event should be sent with this name. This is used to support backward compatibility of actions within the commands framework.- Since:
- 3.1
- See Also:
 
 
- 
- 
Method Details- 
addPropertyChangeListenerAdds a property change listener to this action. Has no effect if an identical listener is already registered.- Parameters:
- listener- a property change listener
 
- 
getAcceleratorint getAccelerator()Returns the accelerator keycode for this action. The result is the bit-wise OR of zero or more modifier masks and a key, as explained inMenuItem.getAccelerator.- Returns:
- the accelerator keycode
- See Also:
 
- 
getActionDefinitionIdString getActionDefinitionId()Returns the action definition id of this action.- Returns:
- the action definition id of this action, or
 nullif none
- Since:
- 2.0
 
- 
getDescriptionString getDescription()Returns the action's description if it has one. Otherwise it returnsgetToolTipText().- Returns:
- a description for the action; may be null
 
- 
getDisabledImageDescriptorImageDescriptor getDisabledImageDescriptor()Returns the disabled image for this action as an image descriptor.This method is associated with the IMAGEproperty; property change events are reported when its value changes.- Returns:
- the image, or nullif this action has no image
- See Also:
 
- 
getHelpListenerHelpListener getHelpListener()Returns a help listener for this action.- Returns:
- a help listener for this action
 
- 
getHoverImageDescriptorImageDescriptor getHoverImageDescriptor()Returns the hover image for this action as an image descriptor.Hover images will be used on platforms that support changing the image when the user hovers over the item. This method is associated with the IMAGEproperty; property change events are reported when its value changes.- Returns:
- the image, or nullif this action has no image
- See Also:
 
- 
getIdString getId()Returns a unique identifier for this action, ornullif it has none.- Returns:
- the action id, or nullif none
 
- 
getImageDescriptorImageDescriptor getImageDescriptor()Returns the image for this action as an image descriptor.This method is associated with the IMAGEproperty; property change events are reported when its value changes.- Returns:
- the image, or nullif this action has no image
- See Also:
 
- 
getMenuCreatorIMenuCreator getMenuCreator()Returns the menu creator for this action.- Returns:
- the menu creator, or nullif none
 
- 
getStyleint getStyle()Return this action's style.- Returns:
- one of AS_PUSH_BUTTON,AS_CHECK_BOX,AS_RADIO_BUTTONandAS_DROP_DOWN_MENU.
 
- 
getTextString getText()Returns the text for this action.This method is associated with the TEXTproperty; property change events are reported when its value changes.- Returns:
- the text, or nullif none
- See Also:
 
- 
getToolTipTextString getToolTipText()Returns the tool tip text for this action.This method is associated with the TOOL_TIP_TEXTproperty; property change events are reported when its value changes.- Returns:
- the tool tip text, or nullif none
- See Also:
 
- 
isCheckedboolean isChecked()Returns the checked status of this action. Applicable only if the style isAS_CHECK_BOXorAS_RADIO_BUTTON.This method is associated with the CHECKEDproperty; property change events are reported when its value changes.- Returns:
- the checked status
- See Also:
 
- 
isEnabledboolean isEnabled()Returns whether this action is enabled.This method is associated with the ENABLEDproperty; property change events are reported when its value changes.- Returns:
- trueif enabled, and- falseif disabled
- See Also:
 
- 
isHandledboolean isHandled()Returns whether this action is handled. In the default case, this is alwaystrue. However, if the action delegates some of its behaviour to some other object, then this method should answer whether such an object is currently available.- Returns:
- trueif all of the action's behaviour is available;- falseotherwise.
- Since:
- 3.1
 
- 
removePropertyChangeListenerRemoves the given listener from this action. Has no effect if an identical listener is not registered.- Parameters:
- listener- a property change listener
 
- 
runvoid run()Runs this action. Each action implementation must define the steps needed to carry out this action. The default implementation of this method inActiondoes nothing.- See Also:
 
- 
runWithEventRuns this action, passing the triggering SWT event. As of 2.0,ActionContributionItemcalls this method instead ofrun(). The default implementation of this method inActionsimply callsrun()for backwards compatibility.- Parameters:
- event- the SWT event which triggered this action being run
- Since:
- 2.0
- See Also:
 
- 
setActionDefinitionIdSets the action definition id of this action.- Parameters:
- id- the action definition id
- Since:
- 2.0
 
- 
setCheckedvoid setChecked(boolean checked) Sets the checked status of this action. Applicable for the stylesAS_CHECK_BOXorAS_RADIO_BUTTON.Fires a property change event for the CHECKEDproperty if the checked status actually changes as a consequence.- Parameters:
- checked- the new checked status
- See Also:
 
- 
setDescriptionSets this action's description. Typically the description is shown as a (longer) help text in the status line.Fires a property change event for the DESCRIPTIONproperty if the description actually changes as a consequence.- Parameters:
- text- the description, or- nullto clear the description
- See Also:
 
- 
setDisabledImageDescriptorSets the disabled image for this action, as an image descriptor.Disabled images will be used on platforms that support changing the image when the item is disabled.Fires a property change event for the IMAGEproperty if the image actually changes as a consequence.- Parameters:
- newImage- the image, or- nullif this action should not have an image
- See Also:
 
- 
setEnabledvoid setEnabled(boolean enabled) Sets the enabled state of this action.When an action is in the enabled state, the control associated with it is active; triggering it will end up inkoking this action's runmethod.Fires a property change event for the ENABLEDproperty if the enabled state actually changes as a consequence.- Parameters:
- enabled-- trueto enable, and- falseto disable
- See Also:
 
- 
setHelpListenerSets a help listener for this action.- Parameters:
- listener- a help listener for this action
 
- 
setHoverImageDescriptorSets the hover image for this action, as an image descriptor.Hover images will be used on platforms that support changing the image when the user hovers over the item.Fires a property change event for the IMAGEproperty if the image actually changes as a consequence.- Parameters:
- newImage- the image, or- nullif this action should not have an image
- See Also:
 
- 
setIdSets the unique identifier for this action. This is used to identify actions when added to a contribution manager. It should be set when the action is created. It should not be modified once the action is part of an action contribution item.- Parameters:
- id- the action id
- See Also:
 
- 
setImageDescriptorSets the image for this action, as an image descriptor.Fires a property change event for the IMAGEproperty if the image actually changes as a consequence.Note: This operation is a hint and is not supported in all contexts on platforms that do not have this concept (for example, Windows NT). Furthermore, some platforms (such as GTK), cannot display both a check box and an image at the same time. Instead, they hide the image and display the check box. - Parameters:
- newImage- the image, or- nullif this action should not have an image
- See Also:
 
- 
setMenuCreatorSets the menu creator for this action. Applicable for styleAS_DROP_DOWN_MENU.- Parameters:
- creator- the menu creator, or- nullif none
 
- 
setTextSets the text for this action.An accelerator is identified by the last index of a '\t' character. If there are no '\t' characters, then it is identified by the last index of an '@' character. If neither, then there is no accelerator text. Note that if you want to insert an '@' character into the text (but no accelerator), then you can simply insert an '@' or a '\t' at the end of the text. 
 An accelerator specification consists of zero or more modifier tokens followed by a key code token. The tokens are separated by a '+' character.Fires a property change event for the TEXTproperty if the text actually changes as a consequence.- Parameters:
- text- the text, or- nullif none
- See Also:
 
- 
setToolTipTextSets the tool tip text for this action.Fires a property change event for the TOOL_TIP_TEXTproperty if the tool tip text actually changes as a consequence.- Parameters:
- text- the tool tip text, or- nullif none
- See Also:
 
- 
setAcceleratorvoid setAccelerator(int keycode) Sets the accelerator keycode that this action maps to. This is a bitwise OR of zero or more SWT key modifier masks (i.e. SWT.CTRL or SWT.ALT) and a character code. For example, for Ctrl+Z, use SWT.CTRL | 'Z'. Use 0 for no accelerator.This method should no longer be used for actions in the Eclipse workbench. IWorkbenchCommandSupportandIWorkbenchContextSupportprovide all the functionality required for key bindings. If you set an accelerator using this method, then it will not work in the workbench if it conflicts any existing key binding, or if there is a different key binding defined for this action's definition id. The definition id should be used instead -- referring to the command in the workbench from which the key binding should be retrieved.- Parameters:
- keycode- the keycode to be accepted.
 
 
-