use of com.intellij.openapi.roots.libraries.LibraryTable in project intellij-community by JetBrains.
the class LibraryTest method testJarDirectoriesSerialization.
public void testJarDirectoriesSerialization() {
LibraryTable table = getLibraryTable();
Library library = ApplicationManager.getApplication().runWriteAction((Computable<Library>) () -> table.createLibrary("jarDirs"));
Library.ModifiableModel model = library.getModifiableModel();
model.addJarDirectory("file://jar-dir", false, OrderRootType.CLASSES);
model.addJarDirectory("file://jar-dir-src", false, OrderRootType.SOURCES);
commit(model);
Element element = serialize(library);
PlatformTestUtil.assertElementEquals("<root>\n" + " <library name=\"jarDirs\">\n" + " <CLASSES>\n" + " <root url=\"file://jar-dir\" />\n" + " </CLASSES>\n" + " <JAVADOC />\n" + " <SOURCES>\n" + " <root url=\"file://jar-dir-src\" />\n" + " </SOURCES>\n" + " <jarDirectory url=\"file://jar-dir\" recursive=\"false\" />\n" + " <jarDirectory url=\"file://jar-dir-src\" recursive=\"false\" type=\"SOURCES\" />\n" + " </library>\n" + "</root>", element);
}
use of com.intellij.openapi.roots.libraries.LibraryTable in project intellij-community by JetBrains.
the class RootsChangedTest method testGlobalLibraryEventsInUncommittedModel.
public void testGlobalLibraryEventsInUncommittedModel() throws Exception {
final LibraryTable globalLibraryTable = LibraryTablesRegistrar.getInstance().getLibraryTable();
verifyLibraryTableEditingInUncommittedModel(globalLibraryTable);
}
use of com.intellij.openapi.roots.libraries.LibraryTable in project intellij-community by JetBrains.
the class SimpleClasspathElementFactory method createElements.
public static List<SimpleClasspathElement> createElements(@NotNull Library library) {
final LibraryTable table = library.getTable();
if (table != null && LibraryTablesRegistrar.APPLICATION_LEVEL.equals(table.getTableLevel())) {
return Collections.<SimpleClasspathElement>singletonList(new GlobalLibraryReferenceElement(library.getName()));
}
final List<SimpleClasspathElement> elements = new ArrayList<>();
for (VirtualFile file : library.getFiles(OrderRootType.CLASSES)) {
elements.add(new SingleRootClasspathElement(file.getUrl()));
}
return elements;
}
use of com.intellij.openapi.roots.libraries.LibraryTable in project intellij-community by JetBrains.
the class LibraryOrderEntryImpl method addListeners.
private void addListeners() {
final String libraryLevel = getLibraryLevel();
final LibraryTable libraryTable = LibraryTablesRegistrar.getInstance().getLibraryTableByLevel(libraryLevel, getRootModel().getModule().getProject());
if (libraryTable != null) {
myProjectRootManagerImpl.addListenerForTable(myLibraryListener, libraryTable);
}
}
use of com.intellij.openapi.roots.libraries.LibraryTable in project intellij-community by JetBrains.
the class LibraryOrderEntryImpl method searchForLibrary.
private void searchForLibrary(@NotNull String name, @NotNull String level) {
if (myLibrary != null)
return;
final LibraryTable libraryTable = LibraryTablesRegistrar.getInstance().getLibraryTableByLevel(level, getRootModel().getModule().getProject());
final Library library = libraryTable != null ? libraryTable.getLibraryByName(name) : null;
if (library == null) {
myLibraryName = name;
myLibraryLevel = level;
myLibrary = null;
} else {
myLibraryName = null;
myLibraryLevel = null;
myLibrary = library;
}
}
Aggregations