void (@NotNull List<? extends LibraryProjectStructureElement> libraries) { List<TreePath> pathsToRemove = new ArrayList<>(); for (LibraryProjectStructureElement element : libraries) { getModelProvider().getModifiableModel().removeLibrary(element.getLibrary()); MyNode node = findNodeByObject(myRoot, element.getLibrary()); if (node != null) { pathsToRemove.add(TreeUtil.getPathFromRoot(node)); } } myContext.getDaemonAnalyzer().removeElements(libraries); removePaths(toTreePathArray(pathsToRemove)); }