void (Object element, final List<Object> result) { if (element instanceof Application) { Collections.addAll(result, ProjectManager.getInstance().getOpenProjects()); final LibraryTablesRegistrar instance = LibraryTablesRegistrar.getInstance(); result.add(instance.getLibraryTable()); //1 result.addAll(instance.getCustomLibraryTables()); //2 } else if (element instanceof Project) { Collections.addAll(result, ModuleManager.getInstance((Project)element).getModules()); result.add(LibraryTablesRegistrar.getInstance().getLibraryTable((Project)element)); } else if (element instanceof LibraryTable) { Collections.addAll(result, ((LibraryTable)element).getLibraries()); } else if (element instanceof Module) { for (OrderEntry entry : ModuleRootManager.getInstance((Module)element).getOrderEntries()) { if (entry instanceof LibraryOrderEntry libraryOrderEntry && LibraryTableImplUtil.MODULE_LEVEL.equals(libraryOrderEntry.getLibraryLevel())) { final Library library = libraryOrderEntry.getLibrary(); result.add(library); } } } }