mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
scope to check for cheap search (IDEA-117665)
This commit is contained in:
+6
-5
@@ -23,6 +23,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.PsiSearchHelper;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
@@ -301,11 +302,11 @@ public class DeclareCollectionAsInterfaceInspection extends BaseInspection {
|
||||
final ProgressManager progressManager =
|
||||
ProgressManager.getInstance();
|
||||
final PsiSearchHelper searchHelper = PsiSearchHelper.SERVICE.getInstance(element.getProject());
|
||||
final GlobalSearchScope scope =
|
||||
GlobalSearchScope.projectScope(element.getProject());
|
||||
return searchHelper.isCheapEnoughToSearch(name, scope, null,
|
||||
progressManager.getProgressIndicator()) !=
|
||||
PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES;
|
||||
SearchScope useScope = element.getUseScope();
|
||||
if (useScope instanceof GlobalSearchScope) {
|
||||
return searchHelper.isCheapEnoughToSearch(name, (GlobalSearchScope)useScope, null, progressManager.getProgressIndicator()) != PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user