boolean (PsiNamedElement element, boolean zeroResult) { final String name = element.getName(); if (name == null) { return true; } final ProgressManager progressManager = ProgressManager.getInstance(); final PsiSearchHelper searchHelper = PsiSearchHelper.getInstance(element.getProject()); final SearchScope useScope = element.getUseScope(); if (!(useScope instanceof GlobalSearchScope)) { return false; } final PsiSearchHelper.SearchCostResult cost = searchHelper.isCheapEnoughToSearch(name, (GlobalSearchScope)useScope, null, progressManager.getProgressIndicator()); if (cost == PsiSearchHelper.SearchCostResult.ZERO_OCCURRENCES) { return zeroResult; } return cost == PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES; }