예제 #1
0
파일: TreeUtil.java 프로젝트: jexp/idea2
 public static List<TreePath> collectExpandedPaths(final JTree tree, TreePath path) {
   final ArrayList<TreePath> result = new ArrayList<TreePath>();
   if (!tree.isExpanded(path)) return result;
   final Object lastPathComponent = path.getLastPathComponent();
   final TreeModel model = tree.getModel();
   if (model.isLeaf(lastPathComponent)) {
     result.add(path);
   } else {
     boolean pathWasAdded = false;
     for (int i = model.getChildCount(lastPathComponent) - 1; i >= 0; i--) {
       final TreePath childPath = path.pathByAddingChild(model.getChild(lastPathComponent, i));
       if (model.isLeaf(lastPathComponent)) {
         if (!pathWasAdded) {
           result.add(path);
           pathWasAdded = true;
         }
       } else if (tree.isExpanded(childPath)) {
         result.addAll(collectExpandedPaths(tree, childPath));
       } else {
         if (!pathWasAdded) {
           result.add(path);
           pathWasAdded = true;
         }
       }
     }
   }
   return result;
 }
예제 #2
0
파일: TreeUtil.java 프로젝트: jexp/idea2
 public static List<TreePath> collectExpandedPaths(@NotNull final JTree tree) {
   final ArrayList<TreePath> result = new ArrayList<TreePath>();
   final Object root = tree.getModel().getRoot();
   final TreePath rootPath = new TreePath(root);
   result.addAll(collectExpandedPaths(tree, rootPath));
   return result;
 }
예제 #3
0
 public Explorer() {
   super(new DynamicNode(ROOT));
   PropertiesSet preferences = PropertiesManager.getPreferencePropertiesSet();
   if (preferences != null) {
     preferences.addPrefixPropertyChangeListener(
         DisplayToolTipsOptionGroup.class,
         DisplayToolTipsOptionGroup.TOOLTIPS_FIELD_VISIBILITY_PREFIX,
         new PreferencesListener());
     Db.addDbListener(dbslistener);
     tooltipsFields.addAll(Arrays.asList(DisplayToolTipsOptionGroup.getAvailableMetaFields()));
   }
 }