From e6ffc971b789cd6c7b2c6ae8d28c0507874bcb5d Mon Sep 17 00:00:00 2001 From: nik Date: Tue, 24 Nov 2009 15:43:08 +0300 Subject: [PATCH] highlighting of libraries in project structure fixed --- .../projectRoot/StructureConfigurableContext.java | 9 +++++++++ .../projectRoot/daemon/LibraryProjectStructureElement.java | 6 ++++-- .../projectRoot/daemon/ModuleProjectStructureElement.java | 12 ++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/StructureConfigurableContext.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/StructureConfigurableContext.java index 5b17b815e8..2cf22d28a8 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/StructureConfigurableContext.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/StructureConfigurableContext.java @@ -140,6 +140,15 @@ public class StructureConfigurableContext implements Disposable { } @Nullable + public Library getLibraryModel(@NotNull Library library) { + final LibraryTable libraryTable = library.getTable(); + if (libraryTable != null) { + return findLibraryModel(library, myLevel2Providers.get(libraryTable.getTableLevel())); + } + return library; + } + + @Nullable private static Library findLibraryModel(final Library library, LibrariesModifiableModel tableModel) { if (tableModel == null) return library; if (tableModel.wasLibraryRemoved(library)) return null; diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/LibraryProjectStructureElement.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/LibraryProjectStructureElement.java index 0fb2837e35..62faa16e5f 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/LibraryProjectStructureElement.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/LibraryProjectStructureElement.java @@ -31,8 +31,10 @@ public class LibraryProjectStructureElement extends ProjectStructureElement { @Override public void check(ProjectStructureProblemsHolder problemsHolder) { - final LibraryEx library = (LibraryEx)myLibrary; - final String libraryName = myLibrary.getName();//todo[nik] get modified name? + final LibraryEx library = (LibraryEx)myContext.getLibraryModel(myLibrary); + if (library == null) return; + + final String libraryName = library.getName(); if (!library.allPathsValid(OrderRootType.CLASSES)) { problemsHolder.registerError(ProjectBundle.message("project.roots.tooltip.library.misconfigured", libraryName)); } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/ModuleProjectStructureElement.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/ModuleProjectStructureElement.java index 7eef60439e..936f2ce224 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/ModuleProjectStructureElement.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/daemon/ModuleProjectStructureElement.java @@ -50,6 +50,18 @@ public class ModuleProjectStructureElement extends ProjectStructureElement { problemsHolder.registerError(ProjectBundle.message("project.roots.library.problem.message", entry.getPresentableName())); } } + //todo[nik] highlight libraries with invalid paths in ClasspathEditor + //else if (entry instanceof LibraryOrderEntry) { + // final LibraryEx library = (LibraryEx)((LibraryOrderEntry)entry).getLibrary(); + // if (library != null) { + // if (!library.allPathsValid(OrderRootType.CLASSES)) { + // problemsHolder.registerError(ProjectBundle.message("project.roots.tooltip.library.misconfigured", entry.getPresentableName())); + // } + // else if (!library.allPathsValid(OrderRootType.SOURCES)) { + // problemsHolder.registerWarning(ProjectBundle.message("project.roots.tooltip.library.misconfigured", entry.getPresentableName())); + // } + // } + //} } } -- 2.11.4.GIT