UsageTarget[] (@NotNull DataProvider dataProvider) { Editor editor = CommonDataKeys.EDITOR.getData(dataProvider); PsiFile file = CommonDataKeys.PSI_FILE.getData(dataProvider); List<UsageTarget> result = new ArrayList<>(); if (file != null && editor != null) { UsageTarget[] targets = findUsageTargets(editor, file); Collections.addAll(result, targets); } PsiElement psiElement = CommonDataKeys.PSI_ELEMENT.getData(dataProvider); if (psiElement != null) { UsageTarget[] targets = findUsageTargets(psiElement); Collections.addAll(result, targets); } return result.isEmpty() ? null : result.toArray(UsageTarget.EMPTY_ARRAY); }