use of com.intellij.openapi.roots.libraries.LibraryTablesRegistrar in project intellij-community by JetBrains.
the class StructureConfigurableContext method resetLibraries.
public void resetLibraries() {
final LibraryTablesRegistrar tablesRegistrar = LibraryTablesRegistrar.getInstance();
myLevel2Providers.clear();
myLevel2Providers.put(LibraryTablesRegistrar.APPLICATION_LEVEL, new LibrariesModifiableModel(tablesRegistrar.getLibraryTable(), myProject, this));
myLevel2Providers.put(LibraryTablesRegistrar.PROJECT_LEVEL, new LibrariesModifiableModel(tablesRegistrar.getLibraryTable(myProject), myProject, this));
for (final LibraryTable table : tablesRegistrar.getCustomLibraryTables()) {
myLevel2Providers.put(table.getTableLevel(), new LibrariesModifiableModel(table, myProject, this));
}
}
use of com.intellij.openapi.roots.libraries.LibraryTablesRegistrar in project intellij-community by JetBrains.
the class ChooseLibrariesFromTablesDialog method getLibraryTables.
public static List<LibraryTable> getLibraryTables(final Project project, final boolean showCustomLibraryTables) {
final List<LibraryTable> tables = new ArrayList<>();
final LibraryTablesRegistrar registrar = LibraryTablesRegistrar.getInstance();
if (project != null) {
tables.add(registrar.getLibraryTable(project));
}
tables.add(registrar.getLibraryTable());
if (showCustomLibraryTables) {
for (LibraryTable table : registrar.getCustomLibraryTables()) {
tables.add(table);
}
}
return tables;
}
use of com.intellij.openapi.roots.libraries.LibraryTablesRegistrar in project intellij-community by JetBrains.
the class EclipseClasspathReader method findLibraryByName.
public static Library findLibraryByName(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;
}
use of com.intellij.openapi.roots.libraries.LibraryTablesRegistrar in project intellij-community by JetBrains.
the class ChooseLibrariesDialogBase method collectChildren.
protected void collectChildren(Object element, final List<Object> result) {
if (element instanceof Application) {
Collections.addAll(result, ProjectManager.getInstance().getOpenProjects());
final LibraryTablesRegistrar instance = LibraryTablesRegistrar.getInstance();
//1
result.add(instance.getLibraryTable());
//2
result.addAll(instance.getCustomLibraryTables());
} 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) {
final LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry) entry;
if (LibraryTableImplUtil.MODULE_LEVEL.equals(libraryOrderEntry.getLibraryLevel())) {
final Library library = libraryOrderEntry.getLibrary();
result.add(library);
}
}
}
}
}
Aggregations