예제 #1
0
 private void removeDescendants(TreePath ancestor) {
   for (Iterator<TreePath> i = checkedPaths.iterator(); i.hasNext(); ) {
     TreePath path = i.next();
     if (ancestor.isDescendant(path)) {
       i.remove();
     }
   }
 }
예제 #2
0
파일: TreeUtil.java 프로젝트: jexp/idea2
 public static void unselect(JTree tree, final DefaultMutableTreeNode node) {
   final TreePath rootPath = new TreePath(node.getPath());
   final TreePath[] selectionPaths = tree.getSelectionPaths();
   if (selectionPaths != null) {
     for (TreePath selectionPath : selectionPaths) {
       if (selectionPath.getPathCount() > rootPath.getPathCount()
           && rootPath.isDescendant(selectionPath)) {
         tree.removeSelectionPath(selectionPath);
       }
     }
   }
 }
예제 #3
0
파일: TreeUtil.java 프로젝트: jexp/idea2
 public static List<TreePath> collectSelectedPaths(final JTree tree, final TreePath treePath) {
   final ArrayList<TreePath> result = new ArrayList<TreePath>();
   final TreePath[] selections = tree.getSelectionPaths();
   if (selections != null) {
     for (TreePath selection : selections) {
       if (treePath.isDescendant(selection)) {
         result.add(selection);
       }
     }
   }
   return result;
 }