public static AnAction[] createActionOrGroup(@NotNull @NlsActions.ActionText String text,
                                               @NotNull BaseLibrariesConfigurable librariesConfigurable,
                                               final @NotNull Project project) {
    final LibraryType<?>[] extensions = LibraryType.EP_NAME.getExtensions();
    List<LibraryType<?>> suitableTypes = new ArrayList<>();
    if (librariesConfigurable instanceof ProjectLibrariesConfigurable || !project.isDefault()) {
      final ModuleStructureConfigurable configurable = librariesConfigurable.getProjectStructureConfigurable().getModulesConfig();
      for (LibraryType<?> extension : extensions) {
        if (!LibraryEditingUtil.getSuitableModules(configurable, extension.getKind(), null).isEmpty()) {
          suitableTypes.add(extension);
        }
      }
    }
    else {
      Collections.addAll(suitableTypes, extensions);
    }

    if (suitableTypes.isEmpty()) {
      return new AnAction[]{new CreateNewLibraryAction(text, PlatformIcons.LIBRARY_ICON, null, librariesConfigurable, project)};
    }
    List<AnAction> actions = new ArrayList<>();
    actions.add(new CreateNewLibraryAction(JavaUiBundle.message("create.default.library.type.action.name"), PlatformIcons.LIBRARY_ICON, null, librariesConfigurable, project));
    for (LibraryType<?> type : suitableTypes) {
      final String actionName = type.getCreateActionName();
      if (actionName != null) {
        actions.add(new CreateNewLibraryAction(actionName, type.getIcon(null), type, librariesConfigurable, project));
      }
    }
    return actions.toArray(AnAction.EMPTY_ARRAY);
  }
public static AnAction[] createActionOrGroup(@NotNull @NlsActions.ActionText String text,
                                               @NotNull BaseLibrariesConfigurable librariesConfigurable,
                                               final @NotNull Project project)