Class HandlerServiceHandler
- All Implemented Interfaces:
IHandler,IHandler2,IObjectWithState,IStateListener
- Direct Known Subclasses:
WorkbenchHandlerServiceHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected WeakReference<IObjectWithState> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a state to this handler.voiddispose()The default implementation does nothing.execute(ExecutionEvent event) Executes with the map of parameter values by name.voidfireHandlerChanged(HandlerEvent handlerEvent) Fires an event to all registered listeners describing changes to this instance.protected IEclipseContextgetExecutionContext(Object evalObj) voidhandleStateChange(State state, Object oldValue) Handles a change to the value in some state.booleanWhether this handler is capable of executing at this time.booleanWhether this handler is capable of handling delegated responsibilities at this time.voidoverrideEnabled(boolean b) voidremoveState(String stateId) Removes a state from this handler.voidsetEnabled(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, getStateIdsMethods inherited from class org.eclipse.core.commands.AbstractHandler
addHandlerListener, hasListeners, removeHandlerListener, setBaseEnabledMethods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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: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:
-
setEnabled
Description copied from class:AbstractHandlerCalled 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:
setEnabledin interfaceIHandler2- Overrides:
setEnabledin classAbstractHandler- Parameters:
evaluationContext- the application context. May benull- See Also:
-
getExecutionContext
-
isHandled
public 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
-
execute
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.
-
fireHandlerChanged
Description copied from class:AbstractHandlerFires 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
AbstractHandlerinorg.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:
fireHandlerChangedin 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:AbstractHandlerWithStateAdds 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:
addStatein interfaceIObjectWithState- Overrides:
addStatein 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:AbstractHandlerWithStateRemoves 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:
removeStatein interfaceIObjectWithState- Overrides:
removeStatein classAbstractHandlerWithState- Parameters:
stateId- The identifier of the state to remove; must not benull.
-
handleStateChange
Description copied from interface:IStateListenerHandles 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:AbstractHandlerThe default implementation does nothing. Subclasses who attach listeners to other objects are encouraged to detach them in this method.- Specified by:
disposein interfaceIHandler- Overrides:
disposein classAbstractHandlerWithState
-