1 11 package org.eclipse.core.commands; 12 13 import org.eclipse.core.commands.common.EventManager; 14 15 28 public abstract class AbstractHandler extends EventManager implements IHandler { 29 30 33 public void addHandlerListener(final IHandlerListener handlerListener) { 34 addListenerObject(handlerListener); 35 } 36 37 43 public void dispose() { 44 } 46 47 63 protected void fireHandlerChanged(final HandlerEvent handlerEvent) { 64 if (handlerEvent == null) { 65 throw new NullPointerException (); 66 } 67 68 final Object [] listeners = getListeners(); 69 for (int i = 0; i < listeners.length; i++) { 70 final IHandlerListener listener = (IHandlerListener) listeners[i]; 71 listener.handlerChanged(handlerEvent); 72 } 73 } 74 75 81 public boolean isEnabled() { 82 return true; 83 } 84 85 91 public boolean isHandled() { 92 return true; 93 } 94 95 112 protected boolean hasListeners() { 113 return isListenerAttached(); 114 } 115 116 119 public void removeHandlerListener(final IHandlerListener handlerListener) { 120 removeListenerObject(handlerListener); 121 } 122 } 123 | Popular Tags |