use of com.intellij.openapi.roots.ui.configuration.libraries.LibraryPresentationManager in project kotlin by JetBrains.
the class CustomLibraryDescriptorWithDeferredConfig method finishLibConfiguration.
public void finishLibConfiguration(@NotNull Module module, @NotNull ModifiableRootModel rootModel) {
DeferredCopyFileRequests deferredCopyFileRequests = getCopyFileRequests();
if (deferredCopyFileRequests == null)
return;
Library library = ProjectStructureUtilKt.findLibrary(rootModel.orderEntries(), new Function1<Library, Boolean>() {
@Override
public Boolean invoke(@NotNull Library library) {
LibraryPresentationManager libraryPresentationManager = LibraryPresentationManager.getInstance();
List<VirtualFile> classFiles = Arrays.asList(library.getFiles(OrderRootType.CLASSES));
return libraryPresentationManager.isLibraryOfKind(classFiles, libraryKind);
}
});
if (library == null) {
return;
}
Library.ModifiableModel model = library.getModifiableModel();
try {
deferredCopyFileRequests.performRequests(module.getProject(), ProjectStructureUtilKt.getModuleDir(module), model);
} finally {
model.commit();
}
}
use of com.intellij.openapi.roots.ui.configuration.libraries.LibraryPresentationManager in project intellij-community by JetBrains.
the class MvcUpgradeAction method removeOldMvcSdk.
public static void removeOldMvcSdk(MvcFramework framework, ModifiableRootModel model) {
final LibraryPresentationManager presentationManager = LibraryPresentationManager.getInstance();
for (OrderEntry entry : model.getOrderEntries()) {
if (entry instanceof LibraryOrderEntry) {
final Library library = ((LibraryOrderEntry) entry).getLibrary();
final LibrariesContainer container = LibrariesContainerFactory.createContainer(model);
if (library != null) {
final VirtualFile[] files = container.getLibraryFiles(library, OrderRootType.CLASSES);
if (presentationManager.isLibraryOfKind(Arrays.asList(files), framework.getLibraryKind())) {
model.removeOrderEntry(entry);
}
}
}
}
}
Aggregations