void (@NotNull AnActionEvent e) { final List<Object> selectedElements = getSelectedElements(); if (selectedElements.isEmpty()) { return; } ApplicationManager.getApplication().runWriteAction(() -> { for (Object selectedElement : selectedElements) { LibraryEditor libraryEditor = getLibraryEditor(); if (selectedElement instanceof ItemElement itemElement) { libraryEditor.removeRoot(itemElement.getUrl(), itemElement.getRootType()); myRootRemovalHandler.onRootRemoved(itemElement.getUrl(), itemElement.getRootType(), libraryEditor); } else if (selectedElement instanceof OrderRootTypeElement orderRootTypeElement) { final OrderRootType rootType = orderRootTypeElement.getOrderRootType(); final String[] urls = libraryEditor.getUrls(rootType); for (String url : urls) { libraryEditor.removeRoot(url, rootType); } } else if (selectedElement instanceof ExcludedRootElement excludedRootElement) { libraryEditor.removeExcludedRoot(excludedRootElement.getUrl()); } } }); libraryChanged(true); }