Eclipse Platform
Release 3.1

org.eclipse.core.commands
Interface IHandler

All Known Implementing Classes:
AbstractHandler

public interface IHandler

A handler is the pluggable piece of a command that handles execution. Each command can have zero or more handlers associated with it (in general), of which only one will be active at any given moment in time. When the command is asked to execute, it will simply pass that request on to its active handler, if any.

Since:
3.1

Method Summary
 void addHandlerListener(IHandlerListener handlerListener)
          Registers an instance of IHandlerListener to listen for changes to properties of this instance.
 void dispose()
          Disposes of this handler.
 Object execute(ExecutionEvent event)
          Executes with the map of parameter values by name.
 boolean isEnabled()
          Returns whether this handler is capable of executing at this moment in time.
 boolean isHandled()
          Returns whether this handler is really capable of handling delegation.
 void removeHandlerListener(IHandlerListener handlerListener)
          Unregisters an instance of IHandlerListener listening for changes to properties of this instance.
 

Method Detail

addHandlerListener

public void addHandlerListener(IHandlerListener handlerListener)
Registers an instance of IHandlerListener to listen for changes to properties of this instance.

Parameters:
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.

dispose

public void dispose()
Disposes of this handler. This method is run once when the object is no longer referenced. This can be used as an opportunity to unhook listeners from other objects.


execute

public Object execute(ExecutionEvent event)
               throws ExecutionException
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.

isEnabled

public boolean isEnabled()
Returns whether this handler is capable of executing at this moment in time.

Returns:
true if the command is enabled; false otherwise.

isHandled

public boolean isHandled()
Returns whether this handler is really capable of handling delegation. In the case of a handler that is a composition of other handlers, this reply is intended to indicate whether the handler is truly capable of receiving delegated responsibilities at this time.

Returns:
true if the handler is handled; false otherwise.

removeHandlerListener

public void removeHandlerListener(IHandlerListener handlerListener)
Unregisters an instance of IHandlerListener listening for changes to properties of this instance.

Parameters:
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.

Eclipse Platform
Release 3.1

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.