Search in sources :

Example 1 with LibraryTablesRegistrar

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));
    }
}
Also used : LibraryTable(com.intellij.openapi.roots.libraries.LibraryTable) LibraryTablesRegistrar(com.intellij.openapi.roots.libraries.LibraryTablesRegistrar)

Example 2 with LibraryTablesRegistrar

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;
}
Also used : LibraryTable(com.intellij.openapi.roots.libraries.LibraryTable) ArrayList(java.util.ArrayList) LibraryTablesRegistrar(com.intellij.openapi.roots.libraries.LibraryTablesRegistrar)

Example 3 with LibraryTablesRegistrar

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;
}
Also used : LibraryTable(com.intellij.openapi.roots.libraries.LibraryTable) LibraryTablesRegistrar(com.intellij.openapi.roots.libraries.LibraryTablesRegistrar) Library(com.intellij.openapi.roots.libraries.Library)

Example 4 with LibraryTablesRegistrar

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);
                }
            }
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) LibraryTable(com.intellij.openapi.roots.libraries.LibraryTable) OrderEntry(com.intellij.openapi.roots.OrderEntry) LibraryOrderEntry(com.intellij.openapi.roots.LibraryOrderEntry) LibraryTablesRegistrar(com.intellij.openapi.roots.libraries.LibraryTablesRegistrar) LibraryOrderEntry(com.intellij.openapi.roots.LibraryOrderEntry) Library(com.intellij.openapi.roots.libraries.Library) Module(com.intellij.openapi.module.Module) Application(com.intellij.openapi.application.Application)

Aggregations

LibraryTable (com.intellij.openapi.roots.libraries.LibraryTable)4 LibraryTablesRegistrar (com.intellij.openapi.roots.libraries.LibraryTablesRegistrar)4 Library (com.intellij.openapi.roots.libraries.Library)2 Application (com.intellij.openapi.application.Application)1 Module (com.intellij.openapi.module.Module)1 Project (com.intellij.openapi.project.Project)1 LibraryOrderEntry (com.intellij.openapi.roots.LibraryOrderEntry)1 OrderEntry (com.intellij.openapi.roots.OrderEntry)1 ArrayList (java.util.ArrayList)1