Index: TreeView.java =================================================================== RCS file: /cvs/openide/src/org/openide/explorer/view/TreeView.java,v retrieving revision 1.137 diff -r1.137 TreeView.java 835d834 < final TreePath path = ev.getPath (); 837c836 < --- > 842,845c841,849 < < // It is OK to use multithreaded shared RP as the requests < // will be serialized in event queue later < scheduled = RequestProcessor.getDefault().post (new Runnable () { --- > > class Request implements Runnable { > > private TreePath path; > > public Request (TreePath path) { > this.path = path; > } > 847,856c851,855 < if (!SwingUtilities.isEventDispatchThread()) { < SwingUtilities.invokeLater (this); < return; < } < < if (tree.isExpanded(path)) { < // the tree shows the path - do not collapse < // the tree < return; < } --- > try { > if (!SwingUtilities.isEventDispatchThread()) { > SwingUtilities.invokeLater (this); > return; > } 858,862c857,861 < if (!tree.isVisible(path)) { < // if the path is not visible do not collapse < // the tree < return; < } --- > if (tree.isExpanded(path)) { > // the tree shows the path - do not collapse > // the tree > return; > } 864,867c863,867 < if (treeModel == null) { < // no model, no action, no problem < return; < } --- > if (!tree.isVisible(path)) { > // if the path is not visible do not collapse > // the tree > return; > } 869c869,872 < TreeNode myNode = (TreeNode)path.getLastPathComponent(); --- > if (treeModel == null) { > // no model, no action, no problem > return; > } 871,878c874 < if (treeModel.getPathToRoot(myNode)[0] < != treeModel.getRoot()) { < // the way from the path no longer < // goes to the root, probably someone < // has removed the node on the way up < // System.out.println("different roots."); < return; < } --- > TreeNode myNode = (TreeNode)path.getLastPathComponent(); 880c876,888 < treeModel.nodeStructureChanged(myNode); --- > if (treeModel.getPathToRoot(myNode)[0] > != treeModel.getRoot()) { > // the way from the path no longer > // goes to the root, probably someone > // has removed the node on the way up > // System.out.println("different roots."); > return; > } > > treeModel.nodeStructureChanged(myNode); > } finally { > this.path = null; > } 882c890,894 < }, TIME_TO_COLLAPSE); --- > } > > // It is OK to use multithreaded shared RP as the requests > // will be serialized in event queue later > scheduled = RequestProcessor.getDefault().post (new Request(ev.getPath ()), TIME_TO_COLLAPSE);