use of com.intellij.openapi.roots.libraries.LibraryTable in project intellij-community by JetBrains.
the class MvcModuleStructureUtil method modifyDefaultLibrary.
public static Library.ModifiableModel modifyDefaultLibrary(ModifiableRootModel model, String libName) {
LibraryTable libTable = model.getModuleLibraryTable();
for (Library library : libTable.getLibraries()) {
if (library.getName() != null && library.getName().startsWith(libName)) {
return library.getModifiableModel();
}
}
Library library = LibraryUtil.createLibrary(libTable, libName + " (" + model.getModule().getName() + ')');
for (OrderEntry entry : model.getOrderEntries()) {
if (!(entry instanceof LibraryOrderEntry))
continue;
LibraryOrderEntry libraryEntry = (LibraryOrderEntry) entry;
if (libraryEntry.isModuleLevel() && libraryEntry.getLibrary() == library) {
libraryEntry.setExported(true);
}
}
return library.getModifiableModel();
}
use of com.intellij.openapi.roots.libraries.LibraryTable in project intellij-community by JetBrains.
the class DependenciesImportingTest method testDoNotFailOnAbsentAppLibrary.
public void testDoNotFailOnAbsentAppLibrary() throws Exception {
importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>");
ApplicationManager.getApplication().runWriteAction(() -> {
LibraryTable appTable = LibraryTablesRegistrar.getInstance().getLibraryTable();
Library lib = appTable.createLibrary("foo");
ModuleRootModificationUtil.addDependency(getModule("project"), lib);
appTable.removeLibrary(lib);
});
// should not fail;
importProject();
}
use of com.intellij.openapi.roots.libraries.LibraryTable in project intellij-community by JetBrains.
the class LibraryElementPresentation method getLibraryTableDisplayName.
public static String getLibraryTableDisplayName(final Library library) {
LibraryTable table = library.getTable();
LibraryTablePresentation presentation = table != null ? table.getPresentation() : ModuleLibraryTable.MODULE_LIBRARY_TABLE_PRESENTATION;
return presentation.getDisplayName(false);
}
use of com.intellij.openapi.roots.libraries.LibraryTable in project intellij-community by JetBrains.
the class LibraryElementPresentation method getLibraryTableComment.
public static String getLibraryTableComment(final Library library) {
LibraryTable libraryTable = library.getTable();
String displayName;
if (libraryTable != null) {
displayName = libraryTable.getPresentation().getDisplayName(false);
} else {
Module module = ((LibraryImpl) library).getModule();
String tableName = getLibraryTableDisplayName(library);
displayName = module != null ? "'" + module.getName() + "' " + tableName : tableName;
}
return " (" + displayName + ")";
}
use of com.intellij.openapi.roots.libraries.LibraryTable in project intellij-community by JetBrains.
the class LibraryConfigurable method getBannerSlogan.
@Override
public String getBannerSlogan() {
final LibraryTable libraryTable = myLibrary.getTable();
String libraryType = libraryTable == null ? ProjectBundle.message("module.library.display.name", 1) : libraryTable.getPresentation().getDisplayName(false);
return ProjectBundle.message("project.roots.library.banner.text", getDisplayName(), libraryType);
}
Aggregations