This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 193852
Collapse All | Expand All

(-)openide.explorer/src/org/openide/explorer/ExplorerManager.java (-2 / +36 lines)
Lines 596-601 Link Here
596
        return false;
596
        return false;
597
    }
597
    }
598
598
599
    /** Checks whether given Node is a subnode of exploredContext.
600
    * @return true if specified Node is under current exploredContext
601
    */
602
    private boolean isUnderExplored (Node node) {
603
        Node explored = exploredContext;
604
        if (explored != null) {
605
            while (node != null) {
606
                if (node.equals(explored)) {
607
                    return true;
608
                }
609
610
                node = node.getParentNode();
611
            }
612
        }
613
614
        return false;
615
    }
616
599
    /** Checks whether given Node is a subnode of rootContext.
617
    /** Checks whether given Node is a subnode of rootContext.
600
    * and throws IllegalArgumentException if not.
618
    * and throws IllegalArgumentException if not.
601
    */
619
    */
Lines 1015-1022 Link Here
1015
                    }
1033
                    }
1016
                }
1034
                }
1017
            }
1035
            }
1018
1036
            updateSelection(newSel, remove);
1019
            newSel.removeAll(remove);
1020
            for( Iterator<Node> i=newSel.iterator(); i.hasNext(); ) {
1037
            for( Iterator<Node> i=newSel.iterator(); i.hasNext(); ) {
1021
                Node n = i.next();
1038
                Node n = i.next();
1022
                if( !isUnderRoot( n ) )
1039
                if( !isUnderRoot( n ) )
Lines 1028-1032 Link Here
1028
            
1045
            
1029
            
1046
            
1030
        }
1047
        }
1048
1049
        private void updateSelection (List<Node> newSel, Collection<Node> remove) {
1050
            boolean removed = newSel.removeAll(remove);
1051
            if (removed && newSel.isEmpty()) {
1052
                Node parentSelection = null;
1053
                for (Node n : remove) {
1054
                    Node p = n.getParentNode();
1055
                    if (p != null && !remove.contains(p) && isUnderRoot(p) && isUnderExplored(p)) {
1056
                        parentSelection = p;
1057
                        break;
1058
                    }
1059
                }
1060
                if (parentSelection != null) {
1061
                    newSel.add(parentSelection);
1062
                }
1063
            }
1064
        }
1031
    }
1065
    }
1032
}
1066
}
(-)openide.explorer/src/org/openide/explorer/view/VisualizerEvent.java (-4 / +1 lines)
Lines 158-167 Link Here
158
    }
158
    }
159
    
159
    
160
    static final class Destroyed extends VisualizerEvent implements Runnable {
160
    static final class Destroyed extends VisualizerEvent implements Runnable {
161
        private final VisualizerNode toNull;
161
        public Destroyed(VisualizerChildren ch, NodeEvent ev) {
162
        public Destroyed(VisualizerChildren ch, NodeEvent ev, VisualizerNode toNull) {
163
            super(ch, null, ev, null);
162
            super(ch, null, ev, null);
164
            this.toNull = toNull;
165
        }
163
        }
166
        
164
        
167
        @Override
165
        @Override
Lines 173-179 Link Here
173
                    v.nodeDestroyed(originalEvent);
171
                    v.nodeDestroyed(originalEvent);
174
                }
172
                }
175
            }
173
            }
176
            toNull.parent = null;
177
        }
174
        }
178
    }
175
    }
179
}
176
}
(-)openide.explorer/src/org/openide/explorer/view/VisualizerNode.java (-1 / +1 lines)
Lines 399-405 Link Here
399
    @Override
399
    @Override
400
    public void nodeDestroyed(NodeEvent ev) {
400
    public void nodeDestroyed(NodeEvent ev) {
401
        node = Node.EMPTY;
401
        node = Node.EMPTY;
402
        QUEUE.runSafe(new VisualizerEvent.Destroyed(getChildren(false), ev, this));
402
        QUEUE.runSafe(new VisualizerEvent.Destroyed(getChildren(false), ev));
403
    }
403
    }
404
404
405
    /** Change in the node properties (icon, etc.)
405
    /** Change in the node properties (icon, etc.)

Return to bug 193852