|
Eclipse Platform Release 3.2 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.runtime.ListenerList
org.eclipse.jface.util.ListenerList
ListenerList
instead.
Please note that the ListenerList(int)
and
ListenerList.ListenerList(int)
constructors have different semantics. Please read the javadoc
carefully. Also note that the equivalent of
ListenerList()
is actually
ListenerList.ListenerList(int)
with ListenerList.IDENTITY
as
the argument.
This class is used to maintain a list of listeners, and is used in the implementations of several classes within JFace which allow you to register listeners of various kinds. It is a fairly lightweight object, occupying minimal space when no listeners are registered.
Note that the add
method checks for and eliminates duplicates
based on identity (not equality). Likewise, the remove
method
compares based on identity.
Use the getListeners
method when notifying listeners. Note
that no garbage is created if no listeners are registered. The recommended
code sequence for notifying all registered listeners of say,
FooListener.eventHappened
, is:
Object[] listeners = myListenerList.getListeners(); for (int i = 0; i < listeners.length; ++i) { ((FooListener) listeners[i]).eventHappened(event); }
Field Summary |
---|
Fields inherited from class org.eclipse.core.runtime.ListenerList |
---|
EQUALITY, IDENTITY |
Constructor Summary | |
---|---|
ListenerList()
Deprecated. Creates a listener list with an initial capacity of 1. |
|
ListenerList(int capacity)
Deprecated. Creates a listener list with the given initial capacity. |
Methods inherited from class org.eclipse.core.runtime.ListenerList |
---|
add, clear, getListeners, isEmpty, remove, size |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ListenerList()
public ListenerList(int capacity)
capacity
- the number of listeners which this list can initially accept
without growing its internal representation; must be at least
1
|
Eclipse Platform Release 3.2 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.