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
-
public final class ActionHandler extends AbstractHandler
This class adapts instances of
IActiontoIHandler.- Since:
- 3.1
-
-
Constructor Summary
Constructors Constructor Description ActionHandler(IAction action)Creates a new instance of this class given an instance ofIAction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddHandlerListener(IHandlerListener handlerListener)Registers an instance ofIHandlerListenerto listen for changes to properties of this instance.voiddispose()Removes the property change listener from the action.Objectexecute(ExecutionEvent event)Executes with the map of parameter values by name.IActiongetAction()Returns the action associated with this handlerbooleanisEnabled()Whether this handler is capable of executing at this time.booleanisHandled()Whether this handler is capable of handling delegated responsibilities at this time.voidremoveHandlerListener(IHandlerListener handlerListener)Unregisters an instance ofIHandlerListenerlistening for changes to properties of this instance.StringtoString()-
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 Detail
-
ActionHandler
public ActionHandler(IAction action)
Creates a new instance of this class given an instance ofIAction.- Parameters:
action- the action. Must not benull.
-
-
Method Detail
-
addHandlerListener
public final void addHandlerListener(IHandlerListener handlerListener)
Description copied from interface:IHandlerRegisters an instance ofIHandlerListenerto listen for changes to properties of this instance.- Specified by:
addHandlerListenerin interfaceIHandler- Overrides:
addHandlerListenerin 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:
disposein interfaceIHandler- Overrides:
disposein classAbstractHandler- See Also:
IHandler.dispose()
-
execute
public final Object execute(ExecutionEvent event) throws ExecutionException
Description copied from interface:IHandlerExecutes 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
public final IAction 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:AbstractHandlerWhether 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:
isEnabledin interfaceIHandler- Overrides:
isEnabledin classAbstractHandler- Returns:
true- See Also:
AbstractHandler.setEnabled(Object),AbstractHandler.setBaseEnabled(boolean)
-
isHandled
public final boolean isHandled()
Description copied from class:AbstractHandlerWhether this handler is capable of handling delegated responsibilities at this time. Subclasses may override this method.- Specified by:
isHandledin interfaceIHandler- Overrides:
isHandledin classAbstractHandler- Returns:
true
-
removeHandlerListener
public final void removeHandlerListener(IHandlerListener handlerListener)
Description copied from interface:IHandlerUnregisters an instance ofIHandlerListenerlistening for changes to properties of this instance.- Specified by:
removeHandlerListenerin interfaceIHandler- Overrides:
removeHandlerListenerin 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.
-
-