Class DebugCommandAction
- All Implemented Interfaces:
IDebugContextListener,IAction
IDebugCommandHandler handlers.
The specific type of IDebugCommandHandler is determined by the
abstract getCommandType() method.
This base class is an action which can be instantiated directly by views,
etc. In order to contribute an action using an extension point, a class
implementing IActionDelegate should be created first.
The delegate should then use a DebugCommandAction to implement
the needed functionality. The IActionDelegate must use setActionProxy(IAction)
specifying the workbench's action that is a proxy to the action delegate. This
way, the workbench action can be updated visually as needed.
Note: IDebugCommandHandler command typically act on the active
debug context as opposed to the active selection in view or window. The
action delegate should ignore the active window selection, and instead allow
the DebugCommandAction to update itself based on the active
debug context.
Clients may subclass this class.
- Since:
- 3.6
- See Also:
-
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidNotification the debug context has changed as specified by the given event.voiddispose()Clean up when removingprotected IActionReturns the workbench proxy associated with this action ornullif none.protected abstract Class<?>Returns theIDebugCommandHandlercommand handler that type this action executes.protected ISelectionReturns the context (selection) this action operates on.protected IDebugContextServiceReturns the context service this action linked to.abstract ImageDescriptorReturns the disabled image for this action as an image descriptor.abstract StringReturns the help context id for this action ornullif none.abstract ImageDescriptorReturns the hover image for this action as an image descriptor.abstract StringgetId()Returns a unique identifier for this action, ornullif it has none.abstract ImageDescriptorReturns the image for this action as an image descriptor.protected booleanReturns whether this action should be enabled when initialized and there is no active debug context.abstract StringgetText()Returns the text for this action.abstract StringReturns the tool tip text for this action.voidinit(IWorkbenchPart part) Initializes this action for a specific part.voidinit(IWorkbenchWindow window) Initializes this action for a workbench window.protected voidpostExecute(IRequest request, Object[] targets) This method is called after the completion of the execution of this command.voidrun()The default implementation of thisIActionmethod does nothing.voidrunWithEvent(Event event) The default implementation of thisIActionmethod ignores the event argument, and simply callsrun().voidsetActionProxy(IAction action) Sets the current workbench action that is a proxy to anIActionDelegatethat is using this action to perform its actual work.voidsetEnabled(boolean enabled) Sets the enabled state of this action.Methods inherited from class org.eclipse.jface.action.Action
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getHelpListener, getMenuCreator, getStyle, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipTextMethods inherited from class org.eclipse.jface.action.AbstractAction
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListenerMethods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
Constructor Details
-
DebugCommandAction
public DebugCommandAction()Constructor
-
-
Method Details
-
setActionProxy
Sets the current workbench action that is a proxy to anIActionDelegatethat is using this action to perform its actual work. This only needs to be called when anIActionDelegateis using one of these actions to perform its function.- Parameters:
action- workbench proxy action
-
postExecute
This method is called after the completion of the execution of this command. Extending classes may override this method to perform additional operation after command execution.- Parameters:
request- The completed request object which was given to the debug command handler.targets- Objects which were the targets of this action
-
getCommandType
Returns theIDebugCommandHandlercommand handler that type this action executes.- Returns:
- command class.
- See Also:
-
debugContextChanged
Description copied from interface:IDebugContextListenerNotification the debug context has changed as specified by the given event.- Specified by:
debugContextChangedin interfaceIDebugContextListener- Parameters:
event- debug context event- See Also:
-
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:IActionSets 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.- Specified by:
setEnabledin interfaceIAction- Overrides:
setEnabledin classAction- Parameters:
enabled-trueto enable, andfalseto disable- See Also:
-
init
Initializes this action for a specific part.- Parameters:
part- workbench part
-
init
Initializes this action for a workbench window.- Parameters:
window- the window
-
getInitialEnablement
protected boolean getInitialEnablement()Returns whether this action should be enabled when initialized and there is no active debug context. By default,falseis returned.- Returns:
- initial enabled state when there is no active context.
-
getContext
Returns the context (selection) this action operates on. By default the active debug context in this action's associated part or window is used, but subclasses may override as required.- Returns:
- the context this action operates on
- Since:
- 3.7
-
run
public void run()Description copied from class:ActionThe default implementation of thisIActionmethod does nothing. Subclasses should override this method if they do not need information from the triggering event, or overriderunWithEvent(Event)if they do. -
runWithEvent
Description copied from class:ActionThe default implementation of thisIActionmethod ignores the event argument, and simply callsrun(). Subclasses should override this method if they need information from the triggering event, or overriderun()if not.- Specified by:
runWithEventin interfaceIAction- Overrides:
runWithEventin classAction- Parameters:
event- the SWT event which triggered this action being run- See Also:
-
dispose
public void dispose()Clean up when removing -
getDebugContextService
Returns the context service this action linked to. By default, this actions is associated with the context service for the window this action is operating in.- Returns:
- associated context service
-
getHelpContextId
Returns the help context id for this action ornullif none.- Returns:
- The help context id for this action or
null
-
getId
Description copied from interface:IActionReturns a unique identifier for this action, ornullif it has none. -
getText
Description copied from interface:IActionReturns the text for this action.This method is associated with the
TEXTproperty; property change events are reported when its value changes. -
getToolTipText
Description copied from interface:IActionReturns 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.- Specified by:
getToolTipTextin interfaceIAction- Overrides:
getToolTipTextin classAction- Returns:
- the tool tip text, or
nullif none - See Also:
-
getDisabledImageDescriptor
Description copied from interface:IActionReturns 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.- Specified by:
getDisabledImageDescriptorin interfaceIAction- Overrides:
getDisabledImageDescriptorin classAction- Returns:
- the image, or
nullif this action has no image - See Also:
-
getHoverImageDescriptor
Description copied from interface:IActionReturns 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.- Specified by:
getHoverImageDescriptorin interfaceIAction- Overrides:
getHoverImageDescriptorin classAction- Returns:
- the image, or
nullif this action has no image - See Also:
-
getImageDescriptor
Description copied from interface:IActionReturns 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.- Specified by:
getImageDescriptorin interfaceIAction- Overrides:
getImageDescriptorin classAction- Returns:
- the image, or
nullif this action has no image - See Also:
-
getActionProxy
Returns the workbench proxy associated with this action ornullif none. This is the workbench proxy to anIActionDelegatethat is using this action to perform its actual work. This is only used when anIActionDelegateis using one of these actions to perform its function.- Returns:
- workbench proxy action or
null
-