Java Code Examples for com.intellij.openapi.fileChooser.FileChooserDescriptorFactory#createMultipleJavaPathDescriptor()

The following examples show how to use com.intellij.openapi.fileChooser.FileChooserDescriptorFactory#createMultipleJavaPathDescriptor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LibraryRootsComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createMultipleJavaPathDescriptor();
  descriptor.setTitle("Exclude from Library");
  descriptor.setDescription("Select directories which should be excluded from the library content. Content of excluded directories won't be processed by IDE.");
  Set<VirtualFile> roots = getNotExcludedRoots();
  descriptor.setRoots(roots.toArray(new VirtualFile[roots.size()]));
  if (roots.size() < 2) {
    descriptor.setIsTreeRootVisible(true);
  }
  VirtualFile toSelect = null;
  for (Object o : getSelectedElements()) {
    Object itemElement = o instanceof ExcludedRootElement ? ((ExcludedRootElement)o).getParentDescriptor() : o;
    if (itemElement instanceof ItemElement) {
      toSelect = VirtualFileManager.getInstance().findFileByUrl(((ItemElement)itemElement).getUrl());
      break;
    }
  }
  final VirtualFile[] files = FileChooser.chooseFiles(descriptor, myPanel, myProject, toSelect);
  if (files.length > 0) {
    ApplicationManager.getApplication().runWriteAction(new Runnable() {
      @Override
      public void run() {
        for (VirtualFile file : files) {
          getLibraryEditor().addExcludedRoot(file.getUrl());
        }
      }
    });
    myLastChosen = files[0];
    libraryChanged(true);
  }
}
 
Example 2
Source File: ChooserBasedAttachRootButtonDescriptor.java    From consulo with Apache License 2.0 4 votes vote down vote up
public FileChooserDescriptor createChooserDescriptor() {
  return FileChooserDescriptorFactory.createMultipleJavaPathDescriptor();
}
 
Example 3
Source File: DocumentationOrderRootTypeUIFactory.java    From consulo with Apache License 2.0 4 votes vote down vote up
public DocumentationPathsEditor(Sdk sdk) {
  super(ProjectBundle.message("library.javadocs.node"), DocumentationOrderRootType.getInstance(), FileChooserDescriptorFactory.createMultipleJavaPathDescriptor(), sdk);
  mySdk = sdk;
}