Library (Project project, String name) { final LibraryTablesRegistrar tablesRegistrar = LibraryTablesRegistrar.getInstance(); Library lib = tablesRegistrar.getLibraryTable().getLibraryByName(name); if (lib == null) { lib = tablesRegistrar.getLibraryTable(project).getLibraryByName(name); } if (lib == null) { for (LibraryTable table : tablesRegistrar.getCustomLibraryTables()) { lib = table.getLibraryByName(name); if (lib != null) { break; } } } return lib; }