private VirtualFile[] getVirtualFileArray() {
   ArrayList<VirtualFile> result = new ArrayList<VirtualFile>();
   TreePath[] selectionPaths = myTree.getSelectionPaths();
   if (selectionPaths != null) {
     for (TreePath selectionPath : selectionPaths) {
       AbstractTreeNode treeNode = (AbstractTreeNode) selectionPath.getLastPathComponent();
       result.addAll(treeNode.getVirtualFiles());
     }
   }
   return VfsUtil.toVirtualFileArray(result);
 }
 @Nullable
 private File[] getFileArray() {
   ArrayList<File> result = new ArrayList<File>();
   TreePath[] selectionPaths = myTree.getSelectionPaths();
   if (selectionPaths != null) {
     for (TreePath selectionPath : selectionPaths) {
       AbstractTreeNode treeNode = (AbstractTreeNode) selectionPath.getLastPathComponent();
       result.addAll(treeNode.getFiles());
     }
   }
   if (result.isEmpty()) return null;
   return result.toArray(new File[result.size()]);
 }
 public static Object extractUserObject(DefaultMutableTreeNode node) {
   Object userObject = node.getUserObject();
   Object element = null;
   if (userObject instanceof AbstractTreeNode) {
     AbstractTreeNode descriptor = (AbstractTreeNode) userObject;
     element = descriptor.getValue();
   } else if (userObject instanceof NodeDescriptor) {
     NodeDescriptor descriptor = (NodeDescriptor) userObject;
     element = descriptor.getElement();
     if (element instanceof AbstractTreeNode) {
       element = ((AbstractTreeNode) element).getValue();
     }
   } else if (userObject != null) {
     element = userObject;
   }
   return element;
 }
Exemplo n.º 4
0
 @Nullable
 protected final Object getParentValue() {
   AbstractTreeNode parent = getParent();
   return parent == null ? null : parent.getValue();
 }