Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 118060 Details for
Bug 255534
Optimize startup performance by replacing EventListenerList implementation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Replacement for the draw2d EventListenerList
EventListenerList.java (text/x-java), 2.05 KB, created by
Iwan Birrer
on 2008-11-17 11:28:09 EST
(
hide
)
Description:
Replacement for the draw2d EventListenerList
Filename:
MIME Type:
Creator:
Iwan Birrer
Created:
2008-11-17 11:28:09 EST
Size:
2.05 KB
patch
obsolete
>package org.eclipse.draw2d; > >import java.util.ArrayList; >import java.util.Collections; >import java.util.HashMap; >import java.util.Iterator; >import java.util.List; >import java.util.Map; > >/** > * This class is intended for internal use only. TODO: If this is for internal > * use only, we should move it to the internal package. > */ >public final class EventListenerList { > > private final Map listenersMap = new HashMap(); > > /** > * Adds a listener of type <i>c</i> to the list. > * > * @param c > * the class > * @param listener > * the listener > */ > public synchronized void addListener(Class c, Object listener) { > if (listener == null || c == null) { > throw new IllegalArgumentException(); > } > > List listeners = (List) listenersMap.get(c); > if (listeners == null) { > listeners = new ArrayList(2); > listenersMap.put(c, listeners); > } > > listeners.add(listener); > } > > /** > * Returns <code>true</code> if this list of listeners contains a listener > * of type <i>c</i>. > * > * @param c > * the type > * @return whether this list contains a listener of type <i>c</i> > */ > public synchronized boolean containsListener(Class c) { > return listenersMap.containsKey(c); > } > > /** > * Returns an Iterator of all the listeners of type <i>c</i>. > * > * @param listenerType > * the type > * @return an Iterator of all the listeners of type <i>c</i> > */ > public synchronized Iterator getListeners(final Class listenerType) { > if (listenersMap.get(listenerType) != null) { > return new ArrayList(((List) listenersMap.get(listenerType))) > .iterator(); > } > return Collections.EMPTY_LIST.iterator(); > } > > /** > * Removes the first <i>listener</i> of the specified type by identity. > * > * @param c > * the type > * @param listener > * the listener > */ > public synchronized void removeListener(Class c, Object listener) { > if (listener == null || c == null) { > throw new IllegalArgumentException(); > } > > List listeners = (List) listenersMap.get(c); > if (listeners != null) { > listeners.remove(listener); > } > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 255534
: 118060 |
118061
|
159408