Package org.eclipse.core.commands.common
Class EventManager
java.lang.Object
org.eclipse.core.commands.common.EventManager
- Direct Known Subclasses:
AbstractAction
,AbstractHandler
,AbstractWorkingSetManager
,BaseLabelProvider
,ColorSelector
,FrameList
,HandleObject
,HandleObjectManager
,IntroPart
,PageListenerList
,PerspectiveListenerList
,PreferenceStore
,PropertySheetEntry
,ResourceRegistry
,ResourceTreeAndListGroup
,ScopedPreferenceStore
,State
,SubActionBars
,Workbench
,WorkbenchPart
A manager to which listeners can be attached. This handles the management of a list of listeners -- optimizing memory and performance. All the methods on this class are guaranteed to be thread-safe.
Clients may extend.
Warning: Do not use this class! Use ListenerList
directly. See
bug 486067.
- Since:
- 3.2
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected final void
addListenerObject
(Object listener) Adds a listener to this manager that will be notified when this manager's state changes.protected final void
Clears all of the listeners from the listener list.protected final Object[]
Returns an array containing all the listeners attached to this event manager.protected final boolean
Whether one or more listeners are attached to the manager.protected final void
removeListenerObject
(Object listener) Removes a listener from this manager.
-
Constructor Details
-
EventManager
public EventManager()
-
-
Method Details
-
addListenerObject
Adds a listener to this manager that will be notified when this manager's state changes. This method has no effect if the same listener is already registered.- Parameters:
listener
- The listener to be added; must not benull
.
-
clearListeners
protected final void clearListeners()Clears all of the listeners from the listener list. -
getListeners
Returns an array containing all the listeners attached to this event manager. The resulting array is unaffected by subsequent adds or removes. If there are no listeners registered, the result is an empty array. Use this method when notifying listeners, so that any modifications to the listener list during the notification will have no effect on the notification itself.Note: Callers of this method must not modify the returned array.
- Returns:
- The listeners currently attached; may be empty, but never
null
-
isListenerAttached
protected final boolean isListenerAttached()Whether one or more listeners are attached to the manager.- Returns:
true
if listeners are attached to the manager;false
otherwise.
-
removeListenerObject
Removes a listener from this manager. Has no effect if the same listener was not already registered.- Parameters:
listener
- The listener to be removed; must not benull
.
-