diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseLibrariesConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseLibrariesConfigurable.java index 64bbab269ee6..cff128d2e6a8 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseLibrariesConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/BaseLibrariesConfigurable.java @@ -255,7 +255,8 @@ public abstract class BaseLibrariesConfigurable extends BaseStructureConfigurabl protected boolean removeLibrary(final Library library) { final LibraryTable table = library.getTable(); if (table != null) { - final Collection usages = myContext.getDaemonAnalyzer().getUsages(new LibraryProjectStructureElement(myContext, library)); + final LibraryProjectStructureElement libraryElement = new LibraryProjectStructureElement(myContext, library); + final Collection usages = new ArrayList(myContext.getDaemonAnalyzer().getUsages(libraryElement)); if (usages.size() > 0) { final MultiMap containerType2Usage = new MultiMap(); for (final ProjectStructureElementUsage usage : usages) { @@ -295,12 +296,12 @@ public abstract class BaseLibrariesConfigurable extends BaseStructureConfigurabl } getModelProvider().getModifiableModel().removeLibrary(library); - myContext.getDaemonAnalyzer().removeElement(new LibraryProjectStructureElement(myContext, library)); + myContext.getDaemonAnalyzer().removeElement(libraryElement); return true; } } else { getModelProvider().getModifiableModel().removeLibrary(library); - myContext.getDaemonAnalyzer().removeElement(new LibraryProjectStructureElement(myContext, library)); + myContext.getDaemonAnalyzer().removeElement(libraryElement); return true; } }