diff --git a/openide.explorer/src/org/openide/explorer/view/VisualizerChildren.java b/openide.explorer/src/org/openide/explorer/view/VisualizerChildren.java --- a/openide.explorer/src/org/openide/explorer/view/VisualizerChildren.java +++ b/openide.explorer/src/org/openide/explorer/view/VisualizerChildren.java @@ -75,6 +75,11 @@ * and fires info to all listeners. */ public void added(VisualizerEvent.Added ev) { + if (this != parent.getChildren()) { + // children were replaced (e.g. VisualizerNode.naturalOrder()), quit processing event + return; + } + ListIterator it = list.listIterator(); boolean empty = !it.hasNext(); @@ -125,6 +130,11 @@ * and fires info to all listeners. */ public void removed(VisualizerEvent.Removed ev) { + if (this != parent.getChildren()) { + // children were replaced (e.g. VisualizerNode.naturalOrder()), quit processing event + return; + } + List remList = Arrays.asList(ev.getRemovedNodes()); Iterator it = list.iterator(); @@ -199,6 +209,11 @@ * and fires info to all listeners. */ public void reordered(VisualizerEvent.Reordered ev) { + if (this != parent.getChildren()) { + // children were replaced (e.g. VisualizerNode.naturalOrder()), quit processing event + return; + } + if (ev.getComparator() != null) { //#37802 ev.array = reorderByComparator(ev.getComparator());