@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); }
@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; }
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; }
@Override boolean isAutoExpandNode(NodeDescriptor descriptor) { Object element = descriptor.getElement(); if (element == myFile) { return true; } else { return super.isAutoExpandNode(descriptor); } }
@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; }