classes used in xml aren't unused
authorpeter <peter@jetbrains.com>
Tue, 31 Jan 2012 18:27:49 +0000 (19:27 +0100)
committerpeter <peter@jetbrains.com>
Tue, 31 Jan 2012 18:28:41 +0000 (19:28 +0100)
java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java

index 6ab7b118c92f30a52e7d52184639a9e015f95eb7..84e741d7f1dd52e928d9d78fb9ca4c9ebdb0df51 100644 (file)
@@ -616,11 +616,12 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
     SearchScope useScope = member.getUseScope();
     Project project = member.getProject();
     if (useScope instanceof GlobalSearchScope) {
-      GlobalSearchScope scope = (GlobalSearchScope)useScope;
       // some classes may have references from within XML outside dependent modules, e.g. our actions
-      if (member instanceof PsiClass) scope = GlobalSearchScope.projectScope(project).uniteWith(scope);
+      if (member instanceof PsiClass) {
+        useScope = GlobalSearchScope.projectScope(project).uniteWith((GlobalSearchScope)useScope);
+      }
 
-      PsiSearchHelper.SearchCostResult cheapEnough = PsiSearchHelper.SERVICE.getInstance(project).isCheapEnoughToSearch(name, scope,
+      PsiSearchHelper.SearchCostResult cheapEnough = PsiSearchHelper.SERVICE.getInstance(project).isCheapEnoughToSearch(name, (GlobalSearchScope)useScope,
                                                                                                                         helper.shouldIgnoreUsagesInCurrentFile() ? member.getContainingFile() : null,
                                                                                                                         progress);
       if (cheapEnough == PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES) return false;