public abstract class DebugCommandAction extends Action implements IDebugContextListener
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.
IDebugCommandHandler
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 and Description |
---|
DebugCommandAction()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
debugContextChanged(DebugContextEvent event)
Notification the debug context has changed as specified by the given event.
|
void |
dispose()
Clean up when removing
|
protected IAction |
getActionProxy()
Returns the workbench proxy associated with this action or
null
if none. |
protected abstract Class<?> |
getCommandType()
Returns the
IDebugCommandHandler
command handler that type this action executes. |
protected ISelection |
getContext()
Returns the context (selection) this action operates on.
|
protected IDebugContextService |
getDebugContextService()
Returns the context service this action linked to.
|
abstract ImageDescriptor |
getDisabledImageDescriptor()
Returns the disabled image for this action as an image descriptor.
|
abstract String |
getHelpContextId()
Returns the help context id for this action or
null if none. |
abstract ImageDescriptor |
getHoverImageDescriptor()
Returns the hover image for this action as an image descriptor.
|
abstract String |
getId()
Returns a unique identifier for this action, or
null if it has
none. |
abstract ImageDescriptor |
getImageDescriptor()
Returns the image for this action as an image descriptor.
|
protected boolean |
getInitialEnablement()
Returns whether this action should be enabled when initialized
and there is no active debug context.
|
abstract String |
getText()
Returns the text for this action.
|
abstract String |
getToolTipText()
Returns the tool tip text for this action.
|
void |
init(IWorkbenchPart part)
Initializes this action for a specific part.
|
void |
init(IWorkbenchWindow window)
Initializes this action for a workbench window.
|
protected void |
postExecute(IRequest request,
Object[] targets)
This method is called after the completion of the execution of this
command.
|
void |
run()
The default implementation of this
IAction method does
nothing. |
void |
runWithEvent(Event event)
The default implementation of this
IAction method ignores
the event argument, and simply calls run() . |
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. |
void |
setEnabled(boolean enabled)
Sets the enabled state of this 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, setToolTipText
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
public void setActionProxy(IAction action)
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.action
- workbench proxy actionprotected void postExecute(IRequest request, Object[] targets)
request
- The completed request object which was given to the
debug command handler.targets
- Objects which were the targets of this actionprotected abstract Class<?> getCommandType()
IDebugCommandHandler
command handler that type this action executes.IDebugCommandHandler
public void debugContextChanged(DebugContextEvent event)
IDebugContextListener
debugContextChanged
in interface IDebugContextListener
event
- debug context eventIDebugContextListener.debugContextChanged(org.eclipse.debug.ui.contexts.DebugContextEvent)
public void setEnabled(boolean enabled)
IAction
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.
setEnabled
in interface IAction
setEnabled
in class Action
enabled
- true
to enable, and
false
to disableAction.setEnabled(boolean)
public void init(IWorkbenchPart part)
part
- workbench partpublic void init(IWorkbenchWindow window)
window
- the windowprotected boolean getInitialEnablement()
false
is returned.protected ISelection getContext()
public void run()
Action
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.run
in interface IAction
run
in class Action
How radio buttons are handled
,
How check boxes are handled
public void runWithEvent(Event event)
Action
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.runWithEvent
in interface IAction
runWithEvent
in class Action
event
- the SWT event which triggered this action being runHow radio buttons are handled
,
How check boxes are handled
public void dispose()
protected IDebugContextService getDebugContextService()
public abstract String getHelpContextId()
null
if none.null
public abstract String getId()
IAction
null
if it has
none.public abstract String getText()
IAction
This method is associated with the TEXT
property;
property change events are reported when its value changes.
getText
in interface IAction
getText
in class Action
null
if noneIAction.TEXT
public abstract String getToolTipText()
IAction
This method is associated with the TOOL_TIP_TEXT
property;
property change events are reported when its value changes.
getToolTipText
in interface IAction
getToolTipText
in class Action
null
if noneIAction.TOOL_TIP_TEXT
public abstract ImageDescriptor getDisabledImageDescriptor()
IAction
This method is associated with the IMAGE
property;
property change events are reported when its value changes.
getDisabledImageDescriptor
in interface IAction
getDisabledImageDescriptor
in class Action
null
if this action has no imageIAction.IMAGE
public abstract ImageDescriptor getHoverImageDescriptor()
IAction
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.
getHoverImageDescriptor
in interface IAction
getHoverImageDescriptor
in class Action
null
if this action has no imageIAction.IMAGE
public abstract ImageDescriptor getImageDescriptor()
IAction
This method is associated with the IMAGE
property;
property change events are reported when its value changes.
getImageDescriptor
in interface IAction
getImageDescriptor
in class Action
null
if this action has no imageIAction.IMAGE
protected IAction getActionProxy()
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.null
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.