Java Code Examples for java.util.prefs.NodeChangeListener#childAdded()

The following examples show how to use java.util.prefs.NodeChangeListener#childAdded() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProxyPreferencesImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void fireNodeEvents(List<EventBag<NodeChangeListener, NodeChangeEvent>> events) {
    if (noEvents) {
        return;
    }
    
    for(EventBag<NodeChangeListener, NodeChangeEvent> bag : events) {
        for(NodeChangeEvent event : bag.getEvents()) {
            for(NodeChangeListener l : bag.getListeners()) {
                try {
                    if ((event instanceof NodeChangeEventExt) && ((NodeChangeEventExt) event).isRemovalEvent()) {
                        l.childRemoved(event);
                    } else {
                        l.childAdded(event);
                    }
                } catch (Throwable t) {
                    LOG.log(Level.WARNING, null, t);
                }
            }
        }
    }
}
 
Example 2
Source File: MountedPreferences.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
protected void notifyNCL(NodeChangeEvent evt, boolean bAdded) {
  synchronized(nclSet) {
    
    for(Iterator<NodeChangeListener> it = nclSet.iterator(); it.hasNext(); ) {
      NodeChangeListener ncl = it.next();
      try {
        if(bAdded) {
          ncl.childAdded(evt);
        } else {
          ncl.childRemoved(evt);
        }
      } catch (Exception e) {
        Activator.log.warn("Failed to notify " + ncl);
      }
    }
  }
}