public JavadocForBinaryQuery.Result findJavadoc(final URL b) {
class R implements JavadocForBinaryQuery.Result, PropertyChangeListener {
private ScalaPlatform platform;
private final ChangeSupport cs = new ChangeSupport(this);
private URL[] cachedRoots;
public R (ScalaPlatform plat) {
this.platform = plat;
this.platform.addPropertyChangeListener (WeakListeners.propertyChange(this,this.platform));
}
public synchronized URL[] getRoots() {
if (this.cachedRoots == null) {
List<URL> l = new ArrayList<URL>();
for (URL u : platform.getJavadocFolders()) {
l.add(getIndexFolder(u));
}
this.cachedRoots = l.toArray(new URL[l.size()]);
}
return this.cachedRoots;
}
public synchronized void addChangeListener(ChangeListener l) {
assert l != null : "Listener can not be null"; //NOI18N
cs.addChangeListener(l);
}
public synchronized void removeChangeListener(ChangeListener l) {
assert l != null : "Listener can not be null"; //NOI18N
cs.removeChangeListener(l);
}
public void propertyChange (PropertyChangeEvent event) {
if (ScalaPlatform.PROP_JAVADOC_FOLDER.equals(event.getPropertyName())) {
synchronized (this) {
this.cachedRoots = null;
}
cs.fireChange();
}
}
}
ScalaPlatformManager jpm = ScalaPlatformManager.getDefault();