Search in sources :

Example 16 with PsiSearchHelper

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;
}
Also used : PsiSearchHelper(com.intellij.psi.search.PsiSearchHelper) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator)

Aggregations

PsiSearchHelper (com.intellij.psi.search.PsiSearchHelper)16 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)11 SearchScope (com.intellij.psi.search.SearchScope)5 ProgressManager (com.intellij.openapi.progress.ProgressManager)4 NotNull (org.jetbrains.annotations.NotNull)4 Project (com.intellij.openapi.project.Project)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 THashSet (gnu.trove.THashSet)3 AnalysisScope (com.intellij.analysis.AnalysisScope)2 com.intellij.codeInspection (com.intellij.codeInspection)2 GlobalInspectionContextBase (com.intellij.codeInspection.ex.GlobalInspectionContextBase)2 Logger (com.intellij.openapi.diagnostic.Logger)2 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)2 ToolExtensionPoints (com.intellij.ToolExtensionPoints)1 GroupNames (com.intellij.codeInsight.daemon.GroupNames)1 HighlightInfoType (com.intellij.codeInsight.daemon.impl.HighlightInfoType)1 HighlightUtilBase (com.intellij.codeInsight.daemon.impl.analysis.HighlightUtilBase)1 EntryPointsManager (com.intellij.codeInspection.ex.EntryPointsManager)1 JobDescriptor (com.intellij.codeInspection.ex.JobDescriptor)1 com.intellij.codeInspection.reference (com.intellij.codeInspection.reference)1