Collection<UsageInfo> (@NotNull PsiElement targetElement, @Nullable SearchScope scope) { Project project = getProject(); FindUsagesHandler handler = ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager().getFindUsagesHandler(targetElement, false); CommonProcessors.CollectProcessor<UsageInfo> processor = new CommonProcessors.CollectProcessor<>(Collections.synchronizedList(new ArrayList<>())); assertNotNull("Cannot find handler for: " + targetElement, handler); PsiElement[] psiElements = ArrayUtil.mergeArrays(handler.getPrimaryElements(), handler.getSecondaryElements()); FindUsagesOptions options = handler.getFindUsagesOptions(null); if (scope != null) options.searchScope = scope; for (PsiElement psiElement : psiElements) { handler.processElementUsages(psiElement, processor, options); } return processor.getResults(); }