Package org.eclipse.jface.commands
Class ActionHandler
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.core.commands.AbstractHandler
org.eclipse.jface.commands.ActionHandler
This class adapts instances of IAction
to IHandler
.
- Since:
- 3.1
-
Constructor Summary
ConstructorDescriptionActionHandler
(IAction action) Creates a new instance of this class given an instance ofIAction
. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addHandlerListener
(IHandlerListener handlerListener) Registers an instance ofIHandlerListener
to listen for changes to properties of this instance.final void
dispose()
Removes the property change listener from the action.final Object
execute
(ExecutionEvent event) Executes with the map of parameter values by name.final IAction
Returns the action associated with this handlerReturn the label for this handler.final boolean
Whether this handler is capable of executing at this time.final boolean
Whether this handler is capable of handling delegated responsibilities at this time.final void
removeHandlerListener
(IHandlerListener handlerListener) Unregisters an instance ofIHandlerListener
listening for changes to properties of this instance.final String
toString()
Methods inherited from class org.eclipse.core.commands.AbstractHandler
fireHandlerChanged, hasListeners, setBaseEnabled, setEnabled
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
Constructor Details
-
ActionHandler
Creates a new instance of this class given an instance ofIAction
.- Parameters:
action
- the action. Must not benull
.
-
-
Method Details
-
addHandlerListener
Description copied from interface:IHandler
Registers an instance ofIHandlerListener
to listen for changes to properties of this instance.- Specified by:
addHandlerListener
in interfaceIHandler
- Overrides:
addHandlerListener
in classAbstractHandler
- Parameters:
handlerListener
- the instance to register. Must not benull
. If an attempt is made to register an instance which is already registered with this instance, no operation is performed.
-
dispose
public final void dispose()Removes the property change listener from the action.- Specified by:
dispose
in interfaceIHandler
- Overrides:
dispose
in classAbstractHandler
- See Also:
-
execute
Description copied from interface:IHandler
Executes with the map of parameter values by name.- Parameters:
event
- An event containing all the information about the current state of the application; must not benull
.- Returns:
- the result of the execution. Reserved for future use, must be
null
. - Throws:
ExecutionException
- if an exception occurred during execution.
-
getAction
Returns the action associated with this handler- Returns:
- the action associated with this handler (not null)
- Since:
- 3.1
-
isEnabled
public final boolean isEnabled()Description copied from class:AbstractHandler
Whether this handler is capable of executing at this time. Subclasses may override this method. If clients override this method they should also consider overridingAbstractHandler.setEnabled(Object)
so they can be notified about framework execution contexts.- Specified by:
isEnabled
in interfaceIHandler
- Overrides:
isEnabled
in classAbstractHandler
- Returns:
true
- See Also:
-
isHandled
public final boolean isHandled()Description copied from class:AbstractHandler
Whether this handler is capable of handling delegated responsibilities at this time. Subclasses may override this method.- Specified by:
isHandled
in interfaceIHandler
- Overrides:
isHandled
in classAbstractHandler
- Returns:
true
-
removeHandlerListener
Description copied from interface:IHandler
Unregisters an instance ofIHandlerListener
listening for changes to properties of this instance.- Specified by:
removeHandlerListener
in interfaceIHandler
- Overrides:
removeHandlerListener
in classAbstractHandler
- Parameters:
handlerListener
- the instance to unregister. Must not benull
. If an attempt is made to unregister an instance which is not already registered with this instance, no operation is performed.
-
toString
-
getHandlerLabel
Description copied from interface:IHandler
Return the label for this handler. The handler can implement this method to provide a more dynamic label according to the actual action that is performed. When returning null, callers may instead use the invoking command label or a generic label.- Returns:
- name of the Handler, can be null
-