List<Library> (@NotNull Set<? extends LibraryKind> kinds, @NotNull Project project, @Nullable StructureConfigurableContext context) { List<Library> libraries = new ArrayList<>(); if (context != null) { Collections.addAll(libraries, context.getProjectLibrariesProvider().getModifiableModel().getLibraries()); Collections.addAll(libraries, context.getGlobalLibrariesProvider().getModifiableModel().getLibraries()); } else { final LibraryTablesRegistrar registrar = LibraryTablesRegistrar.getInstance(); Collections.addAll(libraries, registrar.getLibraryTable(project).getLibraries()); Collections.addAll(libraries, registrar.getLibraryTable().getLibraries()); } final Iterator<Library> iterator = libraries.iterator(); while (iterator.hasNext()) { Library library = iterator.next(); final List<LibraryKind> libraryKinds = getLibraryKinds(library, context); if (!ContainerUtil.intersects(libraryKinds, kinds)) { iterator.remove(); } } return libraries; }