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 14171 Details for
Bug 72583
[1.5] NPE in Scope.minimalErasedCandidate
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
File in which this error is triggered
TemplateCollection.java (text/plain), 3.24 KB, created by
Johan Walles
on 2004-08-25 09:06:34 EDT
(
hide
)
Description:
File in which this error is triggered
Filename:
MIME Type:
Creator:
Johan Walles
Created:
2004-08-25 09:06:34 EDT
Size:
3.24 KB
patch
obsolete
>package com.jrockit.console.methodprofiler; > >import java.util.*; > >import javax.swing.event.*; > >/** > * Provides a listener interface for notifications about when > * a template has been added, removed or when a certain template > * has had its members changed. > * > * @author Marcus Hirt > */ >public class TemplateCollection implements ChangeListener >{ > private Map m_map = new HashMap(); > > /** The listeners waiting for model changes. */ > private EventListenerList m_templateListenerList = new EventListenerList(); > > /** > * Constructor for MethodProfilerTemplateCollection. > */ > public TemplateCollection() > { > super(); > } > > /** > * Adds a template change listeners to listen on this collection. > * The listener will be notified whenever changes to the collection > * is made, or whenever a template in the collection has been modified. > * > * @param l the listener to add. > */ > public void addTemplateChangeListener(TemplateChangeListener l) > { > m_templateListenerList.add(l.getClass(), l); > } > > /** > * Removes a TemplateChangeListener from this TemplateCollection. > * > * @param l the listener to remove. > * > * @see #addTemplateChangeListener(TemplateChangeListener) > */ > public void removeTemplateChangeListener(TemplateChangeListener l) > { > m_templateListenerList.add(l.getClass(), l); > } > > /** > * Works like the HashMap equivalent. Also fires a state change. > * @param key > * @param value > * @see HashMap#put(java.lang.Object, java.lang.Object) > */ > public void addTemplate(String name, MethodProfilerTemplate template) > { > m_map.put(name, template); > template.addChangeListener(this); > fireTemplateChange(TemplateChangeEvent.TYPE_TEMPLATE_ADDED, name); > } > > /** > * Method get. > * @see HashMap#get(Object) > */ > public Object getTemplate(String name) > { > return m_map.get(name); > } > > /** > * @see HashMap#values() > */ > public Collection values() > { > return m_map.values(); > } > > /** > * Removes a template from this collection. > * > * @param name the name of the template to remove. > */ > public void removeTemplate(String name) > { > m_map.remove(name); > fireTemplateChange(TemplateChangeEvent.TYPE_TEMPLATE_REMOVED, name); > } > > /** > * @see HashMap#keySet() > */ > public Collection keySet() > { > return m_map.keySet(); > } > > /** > * @see HashMap#containsKey(java.lang.Object) > */ > public boolean containsKey(Object o) > { > return m_map.containsKey(o); > } > > private void fireTemplateChange(String eventType, String templateName) > { > Object[] listeners = m_templateListenerList.getListenerList(); > > for (int i = listeners.length - 2; i >= 0; i -= 2) > { > if (listeners[i + 1] instanceof TemplateChangeListener) > { > TemplateChangeEvent e = > new TemplateChangeEvent(eventType, templateName); > ((TemplateChangeListener) listeners[i + 1]).onTemplateChange(e); > } > } > } > > /** > * @see javax.swing.event.ChangeListener#stateChanged(ChangeEvent) > */ > public void stateChanged(ChangeEvent e) > { > MethodProfilerTemplate template = > (MethodProfilerTemplate) e.getSource(); > fireTemplateChange( > TemplateChangeEvent.TYPE_TEMPLATE_CONTENT_CHANGED, > template.getName()); > } > > /** > * @return boolean true if the collection contains any templates. > */ > public boolean hasTemplates() > { > if (values() == null || values().size() <= 0) > return false; > return true; > } >}
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 72583
: 14171 |
14645