public static void showDialogAndAddLibraryToDependencies(final Library library, final ProjectStructureConfigurable projectStructureConfigurable, boolean allowEmptySelection) {
    for (ProjectStructureValidator validator : EP_NAME.getExtensions()) {
      if (validator.addLibraryToDependencies(library, projectStructureConfigurable.getProject(), allowEmptySelection)) {
        return;
      }
    }

    final ModuleStructureConfigurable moduleStructureConfigurable = projectStructureConfigurable.getModulesConfig();
    final List<Module> modules =
      LibraryEditingUtil.getSuitableModules(moduleStructureConfigurable, ((LibraryEx)library).getKind(), library);
    if (modules.isEmpty()) return;
    final ChooseModulesDialog
      dlg = new ChooseModulesDialog(moduleStructureConfigurable.getProject(), modules, JavaUiBundle.message("choose.modules.dialog.title"),
                                    JavaUiBundle
                                      .message("choose.modules.dialog.description", library.getName()));
    if (dlg.showAndGet()) {
      final List<Module> chosenModules = dlg.getChosenElements();
      for (Module module : chosenModules) {
        moduleStructureConfigurable.addLibraryOrderEntry(module, library);
      }
    }
  }
public static void showDialogAndAddLibraryToDependencies(final Library library, final ProjectStructureConfigurable projectStructureConfigurable, boolean allowEmptySelection)