Class HandlerServiceHandler
- All Implemented Interfaces:
IHandler
,IHandler2
,IObjectWithState
,IStateListener
- Direct Known Subclasses:
WorkbenchHandlerServiceHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final String
protected WeakReference<IObjectWithState>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a state to this handler.void
dispose()
The default implementation does nothing.execute
(ExecutionEvent event) Executes with the map of parameter values by name.void
fireHandlerChanged
(HandlerEvent handlerEvent) Fires an event to all registered listeners describing changes to this instance.protected IEclipseContext
getExecutionContext
(Object evalObj) void
handleStateChange
(State state, Object oldValue) Handles a change to the value in some state.boolean
Whether this handler is capable of executing at this time.boolean
Whether this handler is capable of handling delegated responsibilities at this time.void
overrideEnabled
(boolean b) void
removeState
(String stateId) Removes a state from this handler.void
setEnabled
(Object evaluationContext) Called by the framework to allow the handler to update its enabled state by extracting the same information available at execution time.toString()
Methods inherited from class org.eclipse.core.commands.AbstractHandlerWithState
getState, getStateIds
Methods inherited from class org.eclipse.core.commands.AbstractHandler
addHandlerListener, hasListeners, removeHandlerListener, setBaseEnabled
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.core.commands.IHandler
getHandlerLabel
-
Field Details
-
commandId
-
currentStateHandler
-
-
Constructor Details
-
HandlerServiceHandler
-
-
Method Details
-
isEnabled
public 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:
-
setEnabled
Description copied from class:AbstractHandler
Called by the framework to allow the handler to update its enabled state by extracting the same information available at execution time. Clients may override if they need to extract information from the application context.- Specified by:
setEnabled
in interfaceIHandler2
- Overrides:
setEnabled
in classAbstractHandler
- Parameters:
evaluationContext
- the application context. May benull
- See Also:
-
getExecutionContext
-
isHandled
public 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
-
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.
-
fireHandlerChanged
Description copied from class:AbstractHandler
Fires an event to all registered listeners describing changes to this instance.Subclasses may extend the definition of this method (i.e., if a different type of listener can be attached to a subclass). This is used primarily for support of
AbstractHandler
inorg.eclipse.ui.workbench
, and clients should be wary of overriding this behaviour. If this method is overridden, then the first line of the method should be "super.fireHandlerChanged(handlerEvent);
".- Overrides:
fireHandlerChanged
in classAbstractHandler
- Parameters:
handlerEvent
- the event describing changes to this instance. Must not benull
.
-
overrideEnabled
public void overrideEnabled(boolean b) -
toString
-
addState
Description copied from class:AbstractHandlerWithState
Adds a state to this handler. This will add this handler as a listener to the state, and then fire a handleStateChange so that the handler can respond to the incoming state.
Clients may extend this method, but they should call this super method first before doing anything else.
- Specified by:
addState
in interfaceIObjectWithState
- Overrides:
addState
in classAbstractHandlerWithState
- Parameters:
stateId
- The identifier indicating the type of state being added; must not benull
.state
- The state to add; must not benull
.- See Also:
-
removeState
Description copied from class:AbstractHandlerWithState
Removes a state from this handler. This will remove this handler as a listener to the state. No event is fired to notify the handler of this change.
Clients may extend this method, but they should call this super method first before doing anything else.
- Specified by:
removeState
in interfaceIObjectWithState
- Overrides:
removeState
in classAbstractHandlerWithState
- Parameters:
stateId
- The identifier of the state to remove; must not benull
.
-
handleStateChange
Description copied from interface:IStateListener
Handles a change to the value in some state.- Parameters:
state
- The state that has changed; nevernull
. The value for this state has been updated to the new value.oldValue
- The old value; may be anything.
-
dispose
public void dispose()Description copied from class:AbstractHandler
The default implementation does nothing. Subclasses who attach listeners to other objects are encouraged to detach them in this method.- Specified by:
dispose
in interfaceIHandler
- Overrides:
dispose
in classAbstractHandlerWithState
-