コード例 #1
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;
 }
コード例 #2
0
    public void valueChanged(TreeSelectionEvent e) {
      TreePath[] paths = e.getPaths();

      boolean enabled = true;
      for (TreePath treePath : paths) {
        if (!e.isAddedPath(treePath)) {
          continue;
        }
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) treePath.getLastPathComponent();
        Object userObject = node.getUserObject();
        if (!(userObject instanceof FileNodeDescriptor)) {
          enabled = false;
          break;
        }
        FileElement descriptor = ((FileNodeDescriptor) userObject).getElement();
        VirtualFile file = descriptor.getFile();
        enabled = file != null && myChooserDescriptor.isFileSelectable(file);
      }
      setOKActionEnabled(enabled);
    }