use of com.intellij.psi.search.PsiSearchHelper in project intellij-community by JetBrains.
the class UnusedPropertyInspection method isPropertyUsed.
private static boolean isPropertyUsed(@NotNull Property property, @NotNull UnusedPropertiesSearchHelper helper, boolean isOnTheFly) {
final ProgressIndicator original = ProgressManager.getInstance().getProgressIndicator();
if (original != null) {
if (original.isCanceled())
return true;
original.setText(PropertiesBundle.message("searching.for.property.key.progress.text", property.getUnescapedKey()));
}
if (ImplicitPropertyUsageProvider.isImplicitlyUsed(property))
return true;
String name = property.getName();
if (name == null)
return true;
if (helper.getSearcher() != null) {
name = helper.getSearcher().getKeyToSearch(name, property.getProject());
if (name == null)
return true;
}
PsiSearchHelper searchHelper = helper.getSearchHelper();
if (mayHaveUsages(property, name, searchHelper, helper.getOwnUseScope(), isOnTheFly, original))
return true;
final GlobalSearchScope widerScope = getWidestUseScope(property.getKey(), property.getProject(), helper.getModule());
if (widerScope != null && mayHaveUsages(property, name, searchHelper, widerScope, isOnTheFly, original))
return true;
return false;
}
Aggregations