Class HandlerServiceHandler

All Implemented Interfaces:
IHandler, IHandler2, IObjectWithState, IStateListener
Direct Known Subclasses:
WorkbenchHandlerServiceHandler

public class HandlerServiceHandler extends AbstractHandlerWithState
Provide an IHandler to delegate calls to.
  • Field Details

  • Constructor Details

    • HandlerServiceHandler

      public HandlerServiceHandler(String commandId)
  • 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 overriding AbstractHandler.setEnabled(Object) so they can be notified about framework execution contexts.
      Specified by:
      isEnabled in interface IHandler
      Overrides:
      isEnabled in class AbstractHandler
      Returns:
      true
      See Also:
    • setEnabled

      public void setEnabled(Object evaluationContext)
      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 interface IHandler2
      Overrides:
      setEnabled in class AbstractHandler
      Parameters:
      evaluationContext - the application context. May be null
      See Also:
    • getExecutionContext

      protected IEclipseContext getExecutionContext(Object evalObj)
    • 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 interface IHandler
      Overrides:
      isHandled in class AbstractHandler
      Returns:
      true
    • execute

      public Object execute(ExecutionEvent event) throws ExecutionException
      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 be null.
      Returns:
      the result of the execution. Reserved for future use, must be null.
      Throws:
      ExecutionException - if an exception occurred during execution.
    • fireHandlerChanged

      public void fireHandlerChanged(HandlerEvent handlerEvent)
      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 in org.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 class AbstractHandler
      Parameters:
      handlerEvent - the event describing changes to this instance. Must not be null.
    • overrideEnabled

      public void overrideEnabled(boolean b)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • addState

      public void addState(String stateId, State state)
      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 interface IObjectWithState
      Overrides:
      addState in class AbstractHandlerWithState
      Parameters:
      stateId - The identifier indicating the type of state being added; must not be null.
      state - The state to add; must not be null.
      See Also:
    • removeState

      public void removeState(String stateId)
      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 interface IObjectWithState
      Overrides:
      removeState in class AbstractHandlerWithState
      Parameters:
      stateId - The identifier of the state to remove; must not be null.
    • handleStateChange

      public void handleStateChange(State state, Object oldValue)
      Description copied from interface: IStateListener
      Handles a change to the value in some state.
      Parameters:
      state - The state that has changed; never null. 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 interface IHandler
      Overrides:
      dispose in class AbstractHandlerWithState