void (@NotNull AnActionEvent e) { FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createMultipleJavaPathDescriptor(); descriptor.setTitle(JavaUiBundle.message("chooser.title.exclude.from.library")); descriptor.setDescription(JavaUiBundle.message( "chooser.description.select.directories.which.should.be.excluded.from.the.library.content")); Set<VirtualFile> roots = getNotExcludedRoots(); descriptor.setRoots(roots.toArray(VirtualFile.EMPTY_ARRAY)); if (roots.size() < 2) { descriptor.withTreeRootVisible(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(() -> { for (VirtualFile file : files) { getLibraryEditor().addExcludedRoot(file.getUrl()); } }); myLastChosen = files[0]; libraryChanged(true); } }