disable inspection tool on directory webstorm/144.695
authorAnna Kozlova <anna.kozlova@jetbrains.com>
Wed, 28 Oct 2015 20:07:56 +0000 (21:07 +0100)
committerAnna Kozlova <anna.kozlova@jetbrains.com>
Thu, 29 Oct 2015 10:18:34 +0000 (11:18 +0100)
EA-69117 - IAE: PackageSetBase.contains

platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java

index 5f7e9014cf99e8864a28fa90db400724eefc4b56..207dc359ce421d01e4d6b467a60511aae51c8da9 100644 (file)
@@ -33,10 +33,8 @@ import com.intellij.profile.ProfileManager;
 import com.intellij.profile.codeInspection.SeverityProvider;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiFile;
-import com.intellij.psi.search.scope.packageSet.CustomScopesProviderEx;
-import com.intellij.psi.search.scope.packageSet.NamedScope;
-import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
-import com.intellij.psi.search.scope.packageSet.PackageSet;
+import com.intellij.psi.search.scope.packageSet.*;
+import com.intellij.psi.util.PsiUtilCore;
 import org.jdom.Element;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -414,9 +412,21 @@ public class ToolsImpl implements Tools {
         final NamedScope scope = state.getScope(project);
         if (scope != null) {
           final PackageSet packageSet = scope.getValue();
-          if (packageSet != null && packageSet.contains(element.getContainingFile(), validationManager)) {
-            state.setEnabled(false);
-            return;
+          if (packageSet != null) {
+            final PsiFile file = element.getContainingFile();
+            if (file != null) {
+              if (packageSet.contains(file, validationManager)) {
+                state.setEnabled(false);
+                return;
+              }
+            }
+            else {
+              if (packageSet instanceof PackageSetBase &&
+                  ((PackageSetBase)packageSet).contains(PsiUtilCore.getVirtualFile(element), project, validationManager)) {
+                state.setEnabled(false);
+                return;
+              }
+            }
           }
         }
       }