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 30014
Collapse All | Expand All

(-)src/org/openide/explorer/view/TreeView.java (-3 / +70 lines)
Lines 115-121 Link Here
115
    transient TreeViewDropSupport dropSupport;
115
    transient TreeViewDropSupport dropSupport;
116
116
117
    transient boolean dropTargetPopupAllowed = true;
117
    transient boolean dropTargetPopupAllowed = true;
118
118
    transient private Container contentPane;
119
    
119
    /** Constructor.
120
    /** Constructor.
120
    */
121
    */
121
    public TreeView () {
122
    public TreeView () {
Lines 180-185 Link Here
180
        // init listener & attach it to closing of
181
        // init listener & attach it to closing of
181
        managerListener = new TreePropertyListener();
182
        managerListener = new TreePropertyListener();
182
        tree.addTreeExpansionListener (managerListener);
183
        tree.addTreeExpansionListener (managerListener);
184
        tree.addTreeWillExpandListener (managerListener);
183
185
184
        // do not care about focus
186
        // do not care about focus
185
        setRequestFocusEnabled (false);
187
        setRequestFocusEnabled (false);
Lines 393-398 Link Here
393
    * @param n node 
395
    * @param n node 
394
    */
396
    */
395
    public void expandNode (Node n) {
397
    public void expandNode (Node n) {
398
396
        lookupExplorerManager ();
399
        lookupExplorerManager ();
397
        
400
        
398
        
401
        
Lines 483-489 Link Here
483
    public void removeNotify () {
486
    public void removeNotify () {
484
        super.removeNotify ();
487
        super.removeNotify ();
485
488
486
        //System.out.println ("Calling remove notify..."); // NOI18N
487
        tree.getSelectionModel().removeTreeSelectionListener(managerListener);
489
        tree.getSelectionModel().removeTreeSelectionListener(managerListener);
488
    }
490
    }
489
491
Lines 660-665 Link Here
660
        return tree.getSelectionModel ().getSelectionMode ();
662
        return tree.getSelectionModel ().getSelectionMode ();
661
    }
663
    }
662
    
664
    
665
    private void showWaitCursor () {
666
        if (getRootPane () == null) return ;
667
        contentPane = getRootPane ().getContentPane ();
668
        if (SwingUtilities.isEventDispatchThread ()) {
669
            contentPane.setCursor (Utilities.createProgressCursor (contentPane));
670
        } else {
671
            SwingUtilities.invokeLater (new Runnable () {
672
                public void run () {
673
                    contentPane.setCursor (Utilities.createProgressCursor (contentPane));
674
                }
675
            });
676
        }
677
    }
678
    
679
    private void showNormalCursor () {
680
        if (contentPane == null) return ;
681
        if (SwingUtilities.isEventDispatchThread ()) {
682
            contentPane.setCursor (null);
683
        } else {
684
            SwingUtilities.invokeLater (new Runnable () {
685
                public void run () {
686
                    contentPane.setCursor (null);
687
                }
688
            });
689
        }
690
    }
691
    
692
    private void prepareWaitCursor (final Node node) {
693
        // check type of node
694
        if (node == null) {
695
            showNormalCursor ();
696
        }
697
        
698
        showWaitCursor ();
699
        RequestProcessor.getDefault ().post (new Runnable () {
700
            public void run () {
701
                try {
702
                node.getChildren ().getNodes (true);
703
                } catch (Exception e) {
704
                    // log a exception
705
                    ErrorManager.getDefault ().notify (ErrorManager.INFORMATIONAL, e);
706
                } finally {
707
                    // show normal cursor above all
708
                    showNormalCursor ();
709
                }
710
            }
711
        });
712
    }
713
    
663
    /** Synchronize the selected nodes from the manager of this Explorer.
714
    /** Synchronize the selected nodes from the manager of this Explorer.
664
    * The default implementation does nothing.
715
    * The default implementation does nothing.
665
    */
716
    */
Lines 691-696 Link Here
691
    class TreePropertyListener implements VetoableChangeListener,
742
    class TreePropertyListener implements VetoableChangeListener,
692
                PropertyChangeListener,
743
                PropertyChangeListener,
693
                TreeExpansionListener,
744
                TreeExpansionListener,
745
                TreeWillExpandListener,
694
                TreeSelectionListener, Runnable {
746
                TreeSelectionListener, Runnable {
695
		
747
		
696
        private RequestProcessor.Task scheduled;
748
        private RequestProcessor.Task scheduled;
Lines 721-727 Link Here
721
773
722
        public synchronized void treeExpanded (TreeExpansionEvent ev) {
774
        public synchronized void treeExpanded (TreeExpansionEvent ev) {
723
            final TreePath path = ev.getPath ();
775
            final TreePath path = ev.getPath ();
724
            
776
725
            RequestProcessor.Task t = scheduled;
777
            RequestProcessor.Task t = scheduled;
726
            if (t != null) {
778
            if (t != null) {
727
                t.cancel ();
779
                t.cancel ();
Lines 733-743 Link Here
733
                public void run () {
785
                public void run () {
734
		    if (!SwingUtilities.isEventDispatchThread()) {
786
		    if (!SwingUtilities.isEventDispatchThread()) {
735
			SwingUtilities.invokeLater (this);
787
			SwingUtilities.invokeLater (this);
788
                        
736
			return;
789
			return;
737
		    }
790
		    }
738
791
739
                    if (!tree.isVisible(path)) {
792
                    if (!tree.isVisible(path)) {
740
                        // if the path is not visible - don't check the children
793
                        // if the path is not visible - don't check the children
794
                        
741
                        return;
795
                        return;
742
                    }
796
                    }
743
		    
797
		    
Lines 755-760 Link Here
755
                        // System.out.println("different roots.");
809
                        // System.out.println("different roots.");
756
                        return;
810
                        return;
757
                    }
811
                    }
812
                    
813
                    // show wait cursor
814
                    //showWaitCursor ();
758
		    
815
		    
759
                    int lastChildIndex = myNode.getChildCount()-1;
816
                    int lastChildIndex = myNode.getChildCount()-1;
760
                    if (lastChildIndex >= 0) {
817
                    if (lastChildIndex >= 0) {
Lines 775-780 Link Here
775
832
776
        public synchronized void treeCollapsed (final TreeExpansionEvent ev) {
833
        public synchronized void treeCollapsed (final TreeExpansionEvent ev) {
777
            final TreePath path = ev.getPath ();
834
            final TreePath path = ev.getPath ();
835
            showNormalCursor ();
778
            
836
            
779
            RequestProcessor.Task t = scheduled;
837
            RequestProcessor.Task t = scheduled;
780
            if (t != null) {
838
            if (t != null) {
Lines 871-876 Link Here
871
            callSelectionChanged ((Node[])ll.toArray (new Node[ll.size ()]));
929
            callSelectionChanged ((Node[])ll.toArray (new Node[ll.size ()]));
872
        }
930
        }
873
931
932
        public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
933
        }
934
        
935
        public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
936
            // prepare wait cursor and optionally show it
937
            TreePath path = event.getPath ();
938
            prepareWaitCursor (DragDropUtilities.secureFindNode (path.getLastPathComponent ()));
939
        }
940
        
874
    } // end of TreePropertyListener
941
    } // end of TreePropertyListener
875
942
876
943
(-)src/org/openide/loaders/FolderChildren.java (-1 / +1 lines)
Lines 249-255 Link Here
249
    }
249
    }
250
250
251
    /** time delay between two inserts of nodes */
251
    /** time delay between two inserts of nodes */
252
    private static final int TIME_DELAY = 256;
252
    private static final int TIME_DELAY = 1024;
253
253
254
    /** Private req processor for Addition's refresh tasks */
254
    /** Private req processor for Addition's refresh tasks */
255
    private static RequestProcessor refRP = 
255
    private static RequestProcessor refRP = 

Return to bug 30014