コード例 #1
0
 @Override
 public String convert(TreePath path) {
   final DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
   final Object userObject = node.getUserObject();
   if (userObject instanceof NodeDescriptor) {
     NodeDescriptor descr = (NodeDescriptor) userObject;
     return descr.toString();
   }
   return TO_STRING.convert(path);
 }
コード例 #2
0
  @Override
  protected boolean isAutoExpandNode(NodeDescriptor nodeDescriptor) {
    if (nodeDescriptor.getElement() instanceof RootFileElement) {
      return true;
    } else if (!SystemInfo.isWindows) {
      NodeDescriptor parent = nodeDescriptor.getParentDescriptor();
      return parent != null && parent.getElement() instanceof RootFileElement;
    }

    return false;
  }
コード例 #3
0
 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;
 }
コード例 #4
0
 @Override
 boolean isAutoExpandNode(NodeDescriptor descriptor) {
   Object element = descriptor.getElement();
   if (element == myFile) {
     return true;
   } else {
     return super.isAutoExpandNode(descriptor);
   }
 }
コード例 #5
0
 @Override
 protected boolean isAlwaysShowPlus(NodeDescriptor nodeDescriptor) {
   Object element = nodeDescriptor.getElement();
   if (element != null) {
     FileElement descriptor = (FileElement) element;
     VirtualFile file = descriptor.getFile();
     if (file != null) {
       if (myChooserDescriptor.isChooseJarContents() && FileElement.isArchive(file)) {
         return true;
       }
       return file.isDirectory();
     }
   }
   return true;
 }