public final class ActionHandler extends AbstractHandler
This class adapts instances of IAction
to IHandler
.
Constructor and Description |
---|
ActionHandler(IAction action)
Creates a new instance of this class given an instance of
IAction . |
Modifier and Type | Method and Description |
---|---|
void |
addHandlerListener(IHandlerListener handlerListener)
Registers an instance of
IHandlerListener to listen for
changes to properties of this instance. |
void |
dispose()
Removes the property change listener from the action.
|
Object |
execute(ExecutionEvent event)
Executes with the map of parameter values by name.
|
IAction |
getAction()
Returns the action associated with this handler
|
boolean |
isEnabled()
Whether this handler is capable of executing at this time.
|
boolean |
isHandled()
Whether this handler is capable of handling delegated responsibilities at
this time.
|
void |
removeHandlerListener(IHandlerListener handlerListener)
Unregisters an instance of
IHandlerListener listening for
changes to properties of this instance. |
String |
toString() |
fireHandlerChanged, hasListeners, setBaseEnabled, setEnabled
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
public ActionHandler(IAction action)
IAction
.action
- the action. Must not be null
.public final void addHandlerListener(IHandlerListener handlerListener)
IHandler
IHandlerListener
to listen for
changes to properties of this instance.addHandlerListener
in interface IHandler
addHandlerListener
in class AbstractHandler
handlerListener
- the instance to register. Must not be null
. If
an attempt is made to register an instance which is already
registered with this instance, no operation is performed.IHandler.addHandlerListener(IHandlerListener)
public final void dispose()
dispose
in interface IHandler
dispose
in class AbstractHandler
IHandler.dispose()
public final Object execute(ExecutionEvent event) throws ExecutionException
IHandler
event
- An event containing all the information about the current
state of the application; must not be null
.null
.ExecutionException
- if an exception occurred during execution.public final IAction getAction()
public final boolean isEnabled()
AbstractHandler
AbstractHandler.setEnabled(Object)
so they can be notified
about framework execution contexts.isEnabled
in interface IHandler
isEnabled
in class AbstractHandler
true
AbstractHandler.setEnabled(Object)
,
AbstractHandler.setBaseEnabled(boolean)
public final boolean isHandled()
AbstractHandler
isHandled
in interface IHandler
isHandled
in class AbstractHandler
true
public final void removeHandlerListener(IHandlerListener handlerListener)
IHandler
IHandlerListener
listening for
changes to properties of this instance.removeHandlerListener
in interface IHandler
removeHandlerListener
in class AbstractHandler
handlerListener
- the instance to unregister. Must not be null
.
If an attempt is made to unregister an instance which is not
already registered with this instance, no operation is
performed.IHandler.removeHandlerListener(IHandlerListener)
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.