Class DebugCommandAction

  • All Implemented Interfaces:
    IDebugContextListener, IAction

    public abstract class DebugCommandAction
    extends Action
    implements IDebugContextListener
    Abstract base class for re-targeting actions which delegate execution to 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:
    IDebugCommandHandler
    • Constructor Detail

      • DebugCommandAction

        public DebugCommandAction()
        Constructor
    • Method Detail

      • setActionProxy

        public void setActionProxy​(IAction action)
        Sets the current workbench action that is a proxy to an IActionDelegate that is using this action to perform its actual work. This only needs to be called when an IActionDelegate is using one of these actions to perform its function.
        Parameters:
        action - workbench proxy action
      • postExecute

        protected void postExecute​(IRequest request,
                                   Object[] targets)
        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
      • setEnabled

        public void setEnabled​(boolean enabled)
        Description copied from interface: IAction
        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 run method.

        Fires a property change event for the ENABLED property if the enabled state actually changes as a consequence.

        Specified by:
        setEnabled in interface IAction
        Overrides:
        setEnabled in class Action
        Parameters:
        enabled - true to enable, and false to disable
        See Also:
        Action.setEnabled(boolean)
      • init

        public void init​(IWorkbenchPart part)
        Initializes this action for a specific part.
        Parameters:
        part - workbench part
      • init

        public void init​(IWorkbenchWindow window)
        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, false is returned.
        Returns:
        initial enabled state when there is no active context.
      • getContext

        protected ISelection 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: Action
        The default implementation of this IAction method does nothing. Subclasses should override this method if they do not need information from the triggering event, or override runWithEvent(Event) if they do.
        Specified by:
        run in interface IAction
        Overrides:
        run in class Action
        See Also:
        How radio buttons are handled, How check boxes are handled
      • runWithEvent

        public void runWithEvent​(Event event)
        Description copied from class: Action
        The default implementation of this IAction method ignores the event argument, and simply calls run(). Subclasses should override this method if they need information from the triggering event, or override run() if not.
        Specified by:
        runWithEvent in interface IAction
        Overrides:
        runWithEvent in class Action
        Parameters:
        event - the SWT event which triggered this action being run
        See Also:
        How radio buttons are handled, How check boxes are handled
      • dispose

        public void dispose()
        Clean up when removing
      • getDebugContextService

        protected IDebugContextService 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

        public abstract String getHelpContextId()
        Returns the help context id for this action or null if none.
        Returns:
        The help context id for this action or null
      • getId

        public abstract String getId()
        Description copied from interface: IAction
        Returns a unique identifier for this action, or null if it has none.
        Specified by:
        getId in interface IAction
        Overrides:
        getId in class Action
        Returns:
        the action id, or null if none
      • getText

        public abstract String getText()
        Description copied from interface: IAction
        Returns the text for this action.

        This method is associated with the TEXT property; property change events are reported when its value changes.

        Specified by:
        getText in interface IAction
        Overrides:
        getText in class Action
        Returns:
        the text, or null if none
        See Also:
        IAction.TEXT
      • getToolTipText

        public abstract String getToolTipText()
        Description copied from interface: IAction
        Returns the tool tip text for this action.

        This method is associated with the TOOL_TIP_TEXT property; property change events are reported when its value changes.

        Specified by:
        getToolTipText in interface IAction
        Overrides:
        getToolTipText in class Action
        Returns:
        the tool tip text, or null if none
        See Also:
        IAction.TOOL_TIP_TEXT
      • getDisabledImageDescriptor

        public abstract ImageDescriptor getDisabledImageDescriptor()
        Description copied from interface: IAction
        Returns the disabled image for this action as an image descriptor.

        This method is associated with the IMAGE property; property change events are reported when its value changes.

        Specified by:
        getDisabledImageDescriptor in interface IAction
        Overrides:
        getDisabledImageDescriptor in class Action
        Returns:
        the image, or null if this action has no image
        See Also:
        IAction.IMAGE
      • getHoverImageDescriptor

        public abstract ImageDescriptor getHoverImageDescriptor()
        Description copied from interface: IAction
        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 IMAGE property; property change events are reported when its value changes.

        Specified by:
        getHoverImageDescriptor in interface IAction
        Overrides:
        getHoverImageDescriptor in class Action
        Returns:
        the image, or null if this action has no image
        See Also:
        IAction.IMAGE
      • getImageDescriptor

        public abstract ImageDescriptor getImageDescriptor()
        Description copied from interface: IAction
        Returns the image for this action as an image descriptor.

        This method is associated with the IMAGE property; property change events are reported when its value changes.

        Specified by:
        getImageDescriptor in interface IAction
        Overrides:
        getImageDescriptor in class Action
        Returns:
        the image, or null if this action has no image
        See Also:
        IAction.IMAGE
      • getActionProxy

        protected IAction getActionProxy()
        Returns the workbench proxy associated with this action or null if none. This is the workbench proxy to an IActionDelegate that is using this action to perform its actual work. This is only used when an IActionDelegate is using one of these actions to perform its function.
        Returns:
        workbench proxy action or null