void (PsiElement file, PsiElement target, @NotNull Editor editor, boolean clearHighlights) { if (file instanceof PsiCompiledFile) { file = ((PsiCompiledFile)file).getDecompiledPsiFile(); } Project project = target.getProject(); final FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager(); final FindUsagesHandlerBase handler = findUsagesManager.getFindUsagesHandler(target, true); // in case of injected file, use host file to highlight all occurrences of the target in each injected file PsiFile context = InjectedLanguageManager.getInstance(project).getTopLevelFile(file); SearchScope searchScope = new LocalSearchScope(context); Collection<PsiReference> refs = handler == null ? ReferencesSearch.search(target, searchScope, false).findAll() : handler.findReferencesToHighlight(target, searchScope); new HighlightUsagesHandler.DoHighlightRunnable(new ArrayList<>(refs), project, target, editor, context, clearHighlights).run(); }