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
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

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




Eclipse Platform
Release 3.5

Class ListenerList

  extended by 

      extended by 

Deprecated. Please use 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.

public class ListenerList
extends ListenerList

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
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.
Method Summary
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()
Creates a listener list with an initial capacity of 1.


public ListenerList(int capacity)
Creates a listener list with the given initial 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.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