Line 835
Link Here
|
835 |
final TreePath path = ev.getPath (); |
|
|
Line 837
Link Here
|
837 |
|
836 |
|
838 |
-- |
|
|
Lines 842-845
Link Here
|
842 |
|
841 |
|
843 |
// It is OK to use multithreaded shared RP as the requests |
842 |
class Request implements Runnable { |
844 |
// will be serialized in event queue later |
843 |
|
845 |
scheduled = RequestProcessor.getDefault().post (new Runnable () { |
844 |
private TreePath path; |
846 |
-- |
845 |
|
|
|
846 |
public Request (TreePath path) { |
847 |
this.path = path; |
848 |
} |
849 |
|
Lines 847-856
Link Here
|
847 |
if (!SwingUtilities.isEventDispatchThread()) { |
851 |
try { |
848 |
SwingUtilities.invokeLater (this); |
852 |
if (!SwingUtilities.isEventDispatchThread()) { |
849 |
return; |
853 |
SwingUtilities.invokeLater (this); |
850 |
} |
854 |
return; |
851 |
|
855 |
} |
852 |
if (tree.isExpanded(path)) { |
|
|
853 |
// the tree shows the path - do not collapse |
854 |
// the tree |
855 |
return; |
856 |
} |
857 |
-- |
Lines 858-862
Link Here
|
858 |
if (!tree.isVisible(path)) { |
857 |
if (tree.isExpanded(path)) { |
859 |
// if the path is not visible do not collapse |
858 |
// the tree shows the path - do not collapse |
860 |
// the tree |
859 |
// the tree |
861 |
return; |
860 |
return; |
862 |
} |
861 |
} |
863 |
-- |
|
|
Lines 864-867
Link Here
|
864 |
if (treeModel == null) { |
863 |
if (!tree.isVisible(path)) { |
865 |
// no model, no action, no problem |
864 |
// if the path is not visible do not collapse |
866 |
return; |
865 |
// the tree |
867 |
} |
866 |
return; |
868 |
-- |
867 |
} |
Line 869
Link Here
|
869 |
TreeNode myNode = (TreeNode)path.getLastPathComponent(); |
869 |
if (treeModel == null) { |
870 |
-- |
870 |
// no model, no action, no problem |
|
|
871 |
return; |
872 |
} |
Lines 871-878
Link Here
|
871 |
if (treeModel.getPathToRoot(myNode)[0] |
874 |
TreeNode myNode = (TreeNode)path.getLastPathComponent(); |
872 |
!= treeModel.getRoot()) { |
|
|
873 |
// the way from the path no longer |
874 |
// goes to the root, probably someone |
875 |
// has removed the node on the way up |
876 |
// System.out.println("different roots."); |
877 |
return; |
878 |
} |
879 |
-- |
Line 880
Link Here
|
880 |
treeModel.nodeStructureChanged(myNode); |
876 |
if (treeModel.getPathToRoot(myNode)[0] |
881 |
-- |
877 |
!= treeModel.getRoot()) { |
|
|
878 |
// the way from the path no longer |
879 |
// goes to the root, probably someone |
880 |
// has removed the node on the way up |
881 |
// System.out.println("different roots."); |
882 |
return; |
883 |
} |
884 |
|
885 |
treeModel.nodeStructureChanged(myNode); |
886 |
} finally { |
887 |
this.path = null; |
888 |
} |
Line 882
Link Here
|
882 |
}, TIME_TO_COLLAPSE); |
890 |
} |
883 |
-- |
891 |
|
|
|
892 |
// It is OK to use multithreaded shared RP as the requests |
893 |
// will be serialized in event queue later |
894 |
scheduled = RequestProcessor.getDefault().post (new Request(ev.getPath ()), TIME_TO_COLLAPSE); |