Index: src/org/openide/explorer/view/TreeView.java =================================================================== RCS file: /cvs/openide/src/org/openide/explorer/view/TreeView.java,v retrieving revision 1.121 diff -u -r1.121 TreeView.java --- src/org/openide/explorer/view/TreeView.java 3 Feb 2003 07:36:56 -0000 1.121 +++ src/org/openide/explorer/view/TreeView.java 5 Feb 2003 17:39:38 -0000 @@ -115,7 +115,8 @@ transient TreeViewDropSupport dropSupport; transient boolean dropTargetPopupAllowed = true; - + transient private Container contentPane; + /** Constructor. */ public TreeView () { @@ -180,6 +181,7 @@ // init listener & attach it to closing of managerListener = new TreePropertyListener(); tree.addTreeExpansionListener (managerListener); + tree.addTreeWillExpandListener (managerListener); // do not care about focus setRequestFocusEnabled (false); @@ -393,6 +395,7 @@ * @param n node */ public void expandNode (Node n) { + lookupExplorerManager (); @@ -483,7 +486,6 @@ public void removeNotify () { super.removeNotify (); - //System.out.println ("Calling remove notify..."); // NOI18N tree.getSelectionModel().removeTreeSelectionListener(managerListener); } @@ -660,6 +662,55 @@ return tree.getSelectionModel ().getSelectionMode (); } + private void showWaitCursor () { + if (getRootPane () == null) return ; + contentPane = getRootPane ().getContentPane (); + if (SwingUtilities.isEventDispatchThread ()) { + contentPane.setCursor (Utilities.createProgressCursor (contentPane)); + } else { + SwingUtilities.invokeLater (new Runnable () { + public void run () { + contentPane.setCursor (Utilities.createProgressCursor (contentPane)); + } + }); + } + } + + private void showNormalCursor () { + if (contentPane == null) return ; + if (SwingUtilities.isEventDispatchThread ()) { + contentPane.setCursor (null); + } else { + SwingUtilities.invokeLater (new Runnable () { + public void run () { + contentPane.setCursor (null); + } + }); + } + } + + private void prepareWaitCursor (final Node node) { + // check type of node + if (node == null) { + showNormalCursor (); + } + + showWaitCursor (); + RequestProcessor.getDefault ().post (new Runnable () { + public void run () { + try { + node.getChildren ().getNodes (true); + } catch (Exception e) { + // log a exception + ErrorManager.getDefault ().notify (ErrorManager.INFORMATIONAL, e); + } finally { + // show normal cursor above all + showNormalCursor (); + } + } + }); + } + /** Synchronize the selected nodes from the manager of this Explorer. * The default implementation does nothing. */ @@ -691,6 +742,7 @@ class TreePropertyListener implements VetoableChangeListener, PropertyChangeListener, TreeExpansionListener, + TreeWillExpandListener, TreeSelectionListener, Runnable { private RequestProcessor.Task scheduled; @@ -721,7 +773,7 @@ public synchronized void treeExpanded (TreeExpansionEvent ev) { final TreePath path = ev.getPath (); - + RequestProcessor.Task t = scheduled; if (t != null) { t.cancel (); @@ -733,11 +785,13 @@ public void run () { if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater (this); + return; } if (!tree.isVisible(path)) { // if the path is not visible - don't check the children + return; } @@ -755,6 +809,9 @@ // System.out.println("different roots."); return; } + + // show wait cursor + //showWaitCursor (); int lastChildIndex = myNode.getChildCount()-1; if (lastChildIndex >= 0) { @@ -775,6 +832,7 @@ public synchronized void treeCollapsed (final TreeExpansionEvent ev) { final TreePath path = ev.getPath (); + showNormalCursor (); RequestProcessor.Task t = scheduled; if (t != null) { @@ -871,6 +929,15 @@ callSelectionChanged ((Node[])ll.toArray (new Node[ll.size ()])); } + public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException { + } + + public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException { + // prepare wait cursor and optionally show it + TreePath path = event.getPath (); + prepareWaitCursor (DragDropUtilities.secureFindNode (path.getLastPathComponent ())); + } + } // end of TreePropertyListener Index: src/org/openide/loaders/FolderChildren.java =================================================================== RCS file: /cvs/openide/src/org/openide/loaders/FolderChildren.java,v retrieving revision 1.61 diff -u -r1.61 FolderChildren.java --- src/org/openide/loaders/FolderChildren.java 4 Feb 2003 13:38:43 -0000 1.61 +++ src/org/openide/loaders/FolderChildren.java 5 Feb 2003 17:39:38 -0000 @@ -249,7 +249,7 @@ } /** time delay between two inserts of nodes */ - private static final int TIME_DELAY = 256; + private static final int TIME_DELAY = 1024; /** Private req processor for Addition's refresh tasks */ private static RequestProcessor refRP =