private Set<PropertyChangeListener> dataObjectListeners;
public void annotate (Line.Set set, Lookup lookup) {
final FileObject fo = lookup.lookup(FileObject.class);
if (fo != null) {
final DataObject dobj = lookup.lookup(DataObject.class);
if (dobj != null) {
PropertyChangeListener pchl = new PropertyChangeListener() {
/** annotate renamed files. */
public void propertyChange(PropertyChangeEvent evt) {
if (DataObject.PROP_PRIMARY_FILE.equals(evt.getPropertyName())) {
FileObject newFO = dobj.getPrimaryFile();
annotate(newFO);
}
}
};
dobj.addPropertyChangeListener(WeakListeners.propertyChange(pchl, dobj));
synchronized (this) {
if (dataObjectListeners == null) {
dataObjectListeners = new HashSet<PropertyChangeListener>();
}
// Prevent from GC.