use of com.intellij.psi.SmartPointerManager in project intellij-community by JetBrains.
the class NavigationGutterIconBuilder method calcPsiTargets.
private static <T> List<SmartPsiElementPointer> calcPsiTargets(Project project, Collection<? extends T> targets, NotNullFunction<T, Collection<? extends PsiElement>> converter) {
SmartPointerManager manager = SmartPointerManager.getInstance(project);
Set<PsiElement> elements = new THashSet<PsiElement>();
final List<SmartPsiElementPointer> list = new ArrayList<SmartPsiElementPointer>(targets.size());
for (final T target : targets) {
for (final PsiElement psiElement : converter.fun(target)) {
if (elements.add(psiElement) && psiElement.isValid()) {
list.add(manager.createSmartPsiElementPointer(psiElement));
}
}
}
return list;
}
Aggregations