Search in sources :

Example 6 with SmartPointerManager

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;
}
Also used : SmartPointerManager(com.intellij.psi.SmartPointerManager) SmartPsiElementPointer(com.intellij.psi.SmartPsiElementPointer) THashSet(gnu.trove.THashSet) PsiElement(com.intellij.psi.PsiElement)

Aggregations

SmartPointerManager (com.intellij.psi.SmartPointerManager)6 PsiElement (com.intellij.psi.PsiElement)4 RelatedItemLineMarkerInfo (com.intellij.codeInsight.daemon.RelatedItemLineMarkerInfo)1 FoldingDescriptor (com.intellij.lang.folding.FoldingDescriptor)1 JSCallExpression (com.intellij.lang.javascript.psi.JSCallExpression)1 JSFile (com.intellij.lang.javascript.psi.JSFile)1 JSImplicitElement (com.intellij.lang.javascript.psi.stubs.JSImplicitElement)1 FoldRegion (com.intellij.openapi.editor.FoldRegion)1 FoldingGroup (com.intellij.openapi.editor.FoldingGroup)1 OpenFileDescriptor (com.intellij.openapi.fileEditor.OpenFileDescriptor)1 IndexNotReadyException (com.intellij.openapi.project.IndexNotReadyException)1 Project (com.intellij.openapi.project.Project)1 TextRange (com.intellij.openapi.util.TextRange)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 PsiFile (com.intellij.psi.PsiFile)1 SmartPsiElementPointer (com.intellij.psi.SmartPsiElementPointer)1 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)1 CommonProcessors (com.intellij.util.CommonProcessors)1 IdFilter (com.intellij.util.indexing.IdFilter)1 THashSet (gnu.trove.THashSet)1