public void added(NodeChangeEvent event) { synchronized (lock) { // It's possible that we've stopped recording, but the listeners have // not yet been removed. // Ensure that we're still recording before writing new data if (currState != State.RECORDING) { return; } IEclipsePreferences childPrefs = (IEclipsePreferences) event.getChild(); addListener(childPrefs); changeLog.add(new NodeChanged(true, new Path(event.getParent().absolutePath()), event.getChild().name())); } }
@Override public void removed(NodeChangeEvent event) { try { // in case preferences are entirely deleted if(event.getParent() == preferences && !preferences.nodeExists("")) { // code below throws exception // preferences.removeNodeChangeListener(this); // preferences.removePreferenceChangeListener(this); return; } } catch (BackingStoreException e) { // ignore return; } if (!isIgnorePreferenceListeners()) { buildPathMap(preferences); } else { rebuildPathMap = true; } }
@Override public void removed(NodeChangeEvent event) { if (event.getChild() instanceof IEclipsePreferences) { ((IEclipsePreferences) event.getChild()).removePreferenceChangeListener(changeListener); } if (tracking) { preferenceEntries.remove(event.getChild().absolutePath()); firePreferencesUpdated(""); } }
@Override public void added(NodeChangeEvent event) { if (tracking && event.getChild() instanceof IEclipsePreferences) { ((IEclipsePreferences) event.getChild()).addPreferenceChangeListener(changeListener); loadPrefsFromNode(event.getChild()); firePreferencesUpdated(""); } }
public void removed(NodeChangeEvent event) { synchronized (lock) { if (currState != State.RECORDING) { return; } recordedNodes.remove(event.getChild()); changeLog.add(new NodeChanged(false, new Path(event.getParent().absolutePath()), event.getChild().name())); } }
/** * Initialize the node change listener. */ private void initializeNodeChangeListener() { if (nodeChangeListener == null) { nodeChangeListener = new IEclipsePreferences.INodeChangeListener() { /* * (non-Javadoc) * * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#added(org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent) */ public void added(NodeChangeEvent event) { if (nodeQualifier.equals(event.getChild().name()) && isListenerAttached()) { getStorePreferences().addPreferenceChangeListener( preferencesListener); } } /* * (non-Javadoc) * * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#removed(org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent) */ public void removed(NodeChangeEvent event) { // Do nothing as there are no events from removed node } }; ((IEclipsePreferences) getStorePreferences().parent()) .addNodeChangeListener(nodeChangeListener); } }
@Override public void added(NodeChangeEvent event) { if (!isIgnorePreferenceListeners()) { buildPathMap(preferences); } else { rebuildPathMap = true; } }