From ea986c92644ab5d56456528657676625637466a9 Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 19 Jan 2012 15:25:44 +0100 Subject: [PATCH] filter out inspections, suppressed for file --- .../com/intellij/codeInspection/SuppressManagerImpl.java | 1 + .../codeInsight/daemon/impl/LocalInspectionsPass.java | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/java/java-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java b/java/java-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java index c0c3b5daf24d..fa83649ba458 100644 --- a/java/java-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java +++ b/java/java-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java @@ -161,6 +161,7 @@ public class SuppressManagerImpl extends SuppressManager { @Nullable public PsiElement getElementToolSuppressedIn(@NotNull final PsiElement place, final String toolId) { + if (place instanceof PsiFile) return null; return ApplicationManager.getApplication().runReadAction(new Computable() { @Nullable public PsiElement compute() { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java index 8af705b67143..fd2e12e5f23a 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java @@ -711,7 +711,14 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass } List getInspectionTools(InspectionProfileWrapper profile) { - return profile.getHighlightingLocalInspectionTools(myFile); + final List tools = profile.getHighlightingLocalInspectionTools(myFile); + for (Iterator iterator = tools.iterator(); iterator.hasNext(); ) { + LocalInspectionToolWrapper tool = iterator.next(); + if (myIgnoreSuppressed && InspectionManagerEx.inspectionResultSuppressed(myFile, tool.getTool())) { + iterator.remove(); + } + } + return tools; } private void doInspectInjectedPsi(@NotNull PsiFile injectedPsi,