Eclipse Platform
Release 3.0

org.eclipse.ui.commands
Class AbstractHandler

java.lang.Object
  extended byorg.eclipse.ui.commands.AbstractHandler
All Implemented Interfaces:
IHandler
Direct Known Subclasses:
ActionHandler

public abstract class AbstractHandler
extends Object
implements IHandler

This class is a partial implementation of IHandler. This abstract implementation provides support for handler listeners. You should subclass from this method unless you want to implement your own listener support. Subclasses should call fireHandlerChanged(HandlerEvent)when the handler changes. Subclasses should also override getAttributeValuesByName()if they have any attributes.

Since:
3.0

Constructor Summary
AbstractHandler()
           
 
Method Summary
 void addHandlerListener(IHandlerListener handlerListener)
          Registers an instance of IHandlerListener to listen for changes to properties of this instance.
 void dispose()
          The default implementation does nothing.
protected  void fireHandlerChanged(HandlerEvent handlerEvent)
          Fires an event to all registered listeners describing changes to this instance.
 Map getAttributeValuesByName()
          This simply return an empty map.
 void removeHandlerListener(IHandlerListener handlerListener)
          Unregisters an instance of IPropertyListener listening for changes to properties of this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.commands.IHandler
execute
 

Constructor Detail

AbstractHandler

public AbstractHandler()
Method Detail

addHandlerListener

public void addHandlerListener(IHandlerListener handlerListener)
Description copied from interface: IHandler
Registers an instance of IHandlerListener to listen for changes to properties of this instance.

Specified by:
addHandlerListener in interface IHandler
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.
See Also:
IHandler.addHandlerListener(IHandlerListener)

dispose

public void dispose()
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
See Also:
IHandler.dispose()

fireHandlerChanged

protected void fireHandlerChanged(HandlerEvent handlerEvent)
Fires an event to all registered listeners describing changes to this instance.

Parameters:
handlerEvent - the event describing changes to this instance. Must not be null.

getAttributeValuesByName

public Map getAttributeValuesByName()
This simply return an empty map. The default implementation has no attributes.

Specified by:
getAttributeValuesByName in interface IHandler
Returns:
the map of attribute values by name. This map may be empty, but is guaranteed not to be null. If this map is not empty, its collection of keys is guaranteed to only contain instances of String.
See Also:
IHandler.getAttributeValuesByName()

removeHandlerListener

public void removeHandlerListener(IHandlerListener handlerListener)
Description copied from interface: IHandler
Unregisters an instance of IPropertyListener listening for changes to properties of this instance.

Specified by:
removeHandlerListener in interface IHandler
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.
See Also:
IHandler.removeHandlerListener(IHandlerListener)

Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

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