void (Collection<Object> foundElements, Collection<? super Usage> usages, Collection<? super PsiElement> targets) { for (Object element : foundElements) { // TODO this should be managed by the contributor !!! if (element instanceof UsageInfo2UsageAdapter) { usages.add((UsageInfo2UsageAdapter)element); } else if (element instanceof SearchEverywhereItem) { usages.add(((SearchEverywhereItem)element).getUsage()); } } ReadAction.run(() -> foundElements.stream() .map(o -> toPsi(o)) .filter(Objects::nonNull) .forEach(element -> { if (element.getTextRange() != null) { UsageInfo usageInfo = new UsageInfo(element); usages.add(new UsageInfo2UsageAdapter(usageInfo)); } else { targets.add(element); } })); }