Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.core.commands
Class AbstractHandler

java.lang.Object
  extended by 

org.eclipse.core.commands.common.EventManager
      extended by 
org.eclipse.core.commands.AbstractHandler
All Implemented Interfaces:
IHandler, IHandler2
Direct Known Subclasses:
AbstractHandler, AbstractHandlerWithState, ActionHandler, CollapseAllHandler, FileBufferOperationHandler, MarkerViewHandler, MergeActionHandler, NewPropertySheetHandler, ShowPerspectiveHandler, ShowViewHandler

public abstract class AbstractHandler
extends EventManager
implements IHandler2

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 can also override isEnabled() and isHandled().

Since:
3.1

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.
protected  boolean hasListeners ()
           Returns true iff there is one or more IHandlerListeners attached to this AbstractHandler.
 boolean isEnabled ()
          Whether this handler is capable of executing at this time.
 boolean isHandled ()
          Whether this handler is capable of handling delegated responsibilities at this time.
 void removeHandlerListener ( IHandlerListener handlerListener)
          Unregisters an instance of IHandlerListener listening for changes to properties of this instance.
protected  void setBaseEnabled (boolean state)
          Allow the default isEnabled() to answer our enabled state.
 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.
 
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, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.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.

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);".

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

isEnabled

public boolean isEnabled()
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 setEnabled(Object) so they can be notified about framework execution contexts.

Specified by:
isEnabled in interface IHandler
Returns:
true
See Also:
setEnabled(Object), setBaseEnabled(boolean)

setBaseEnabled

protected void setBaseEnabled(boolean state)
Allow the default isEnabled() to answer our enabled state. It will fire a HandlerEvent if necessary. If clients use this method they should also consider overriding setEnabled(Object) so they can be notified about framework execution contexts.

Parameters:
state - the enabled state
Since:
3.4

setEnabled

public 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. Clients may override if they need to extract information from the application context.

Specified by:
setEnabled in interface IHandler2
Parameters:
evaluationContext - the application context. May be null
Since:
3.4
See Also:
setBaseEnabled(boolean)

isHandled

public boolean isHandled()
Whether this handler is capable of handling delegated responsibilities at this time. Subclasses may override this method.

Specified by:
isHandled in interface IHandler
Returns:
true

hasListeners

protected boolean hasListeners()

Returns true iff there is one or more IHandlerListeners attached to this AbstractHandler.

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 return value should include "super.hasListeners() ||".

Returns:
true iff there is one or more IHandlerListeners attached to this AbstractHandler

removeHandlerListener

public void removeHandlerListener(
IHandlerListener handlerListener)
Description copied from interface: IHandler
Unregisters an instance of IHandlerListener 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.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire