protected void removeNode(IEclipsePreferences child) { boolean wasRemoved = false; synchronized (this) { if (children != null) { wasRemoved = children.remove(child.name()) != null; if (wasRemoved) makeDirty(); if (children.isEmpty()) children = null; } } if (wasRemoved) fireNodeEvent(new NodeChangeEvent(this, child), false); }
/** * Implements the node(String) method, and optionally notifies listeners. */ protected IEclipsePreferences internalNode(String path, boolean notify, Object context) { // illegal state if this node has been removed checkRemoved(); // short circuit this node if (path.length() == 0) return this; // if we have an absolute path use the root relative to // this node instead of the global root // in case we have a different hierarchy. (e.g. export) if (path.charAt(0) == IPath.SEPARATOR) return (IEclipsePreferences) calculateRoot().node(path.substring(1)); int index = path.indexOf(IPath.SEPARATOR); String key = index == -1 ? path : path.substring(0, index); boolean added = false; IEclipsePreferences child = getChild(key, context, true); if (child == null) { child = create(this, key, context); added = true; } // notify listeners if a child was added if (added && notify) fireNodeEvent(new NodeChangeEvent(this, child), true); return (IEclipsePreferences) child.node(index == -1 ? EMPTY_STRING : path.substring(index + 1)); }
/** * Implements the node(String) method, and optionally notifies listeners. */ protected IEclipsePreferences internalNode(String path, boolean notify, Object context) { // illegal state if this node has been removed checkRemoved(); // short circuit this node if (path.length() == 0) return this; // if we have an absolute path use the root relative to // this node instead of the global root // in case we have a different hierarchy. (e.g. export) if (path.charAt(0) == IPath.SEPARATOR) return (IEclipsePreferences) calculateRoot().node(path.substring(1)); int index = path.indexOf(IPath.SEPARATOR); String key = index == -1 ? path : path.substring(0, index); boolean added = false; IEclipsePreferences child = getChild(key, context, true); if (child == null) { child = create(this, key, context); added = true; } // notify listeners if a child was added if (added && notify) fireNodeEvent(new NodeChangeEvent(this, child), true); return (IEclipsePreferences) child.node(index == -1 ? EMPTY_STRING : path.substring(index + 1)); }
protected void removeNode(IEclipsePreferences child) { if (removeNode(child.name()) != null) { fireNodeEvent(new NodeChangeEvent(this, child), false); if (descriptor != null) descriptor.removed(child.absolutePath()); } }