private static void createEclipseLibrary(final Project project, final Collection<String> libraries, final String libraryName) {
    if (libraries.contains(libraryName)) {
      final FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(false, true, false, false, false, false) {
        @Override
        public Icon getIcon(final VirtualFile file) {
          return looksLikeEclipse(file) ? dressIcon(file, AllIcons.Providers.Eclipse) : super.getIcon(file);
        }

        private static boolean looksLikeEclipse(final VirtualFile file) {
          return file.findChild(".eclipseproduct") != null;
        }
      };
      fileChooserDescriptor.setTitle(EclipseBundle.message("eclipse.create.library.title"));
      fileChooserDescriptor.setDescription(EclipseBundle.message("eclipse.create.library.description", libraryName));
      final VirtualFile file = FileChooser.chooseFile(fileChooserDescriptor, project, null);
      if (file != null) {
        final VirtualFile pluginsDir = file.findChild("plugins");
        if (pluginsDir != null) {
          ApplicationManager.getApplication().runWriteAction(() -> {
            final LibraryTable table =
              LibraryTablesRegistrar.getInstance().getLibraryTableByLevel(LibraryTablesRegistrar.APPLICATION_LEVEL, project);
            assert table != null;
            final LibraryTable.ModifiableModel tableModel = table.getModifiableModel();
            final Library library = tableModel.createLibrary(libraryName);
            final Library.ModifiableModel libraryModel = library.getModifiableModel();
            libraryModel.addJarDirectory(pluginsDir, true);
            libraryModel.commit();
            tableModel.commit();
          });
          libraries.remove(libraryName);
        }
      }
    }
  }
private static void createEclipseLibrary(final Project project, final Collection<String> libraries, final String libraryName)