Search in sources :

Example 1 with FieldSmartPointerNode

use of com.intellij.ide.favoritesTreeView.smartPointerPsiNodes.FieldSmartPointerNode in project intellij-community by JetBrains.

the class PsiFieldFavoriteNodeProvider method getFavoriteNodes.

@Override
public Collection<AbstractTreeNode> getFavoriteNodes(final DataContext context, final ViewSettings viewSettings) {
    final Project project = CommonDataKeys.PROJECT.getData(context);
    if (project == null)
        return null;
    PsiElement[] elements = LangDataKeys.PSI_ELEMENT_ARRAY.getData(context);
    if (elements == null) {
        final PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(context);
        if (element != null) {
            elements = new PsiElement[] { element };
        }
    }
    if (elements != null) {
        final Collection<AbstractTreeNode> result = new ArrayList<>();
        for (PsiElement element : elements) {
            if (element instanceof PsiField) {
                result.add(new FieldSmartPointerNode(project, element, viewSettings));
            }
        }
        return result.isEmpty() ? null : result;
    }
    return null;
}
Also used : Project(com.intellij.openapi.project.Project) FieldSmartPointerNode(com.intellij.ide.favoritesTreeView.smartPointerPsiNodes.FieldSmartPointerNode) PsiField(com.intellij.psi.PsiField) ArrayList(java.util.ArrayList) AbstractTreeNode(com.intellij.ide.util.treeView.AbstractTreeNode) PsiElement(com.intellij.psi.PsiElement)

Aggregations

FieldSmartPointerNode (com.intellij.ide.favoritesTreeView.smartPointerPsiNodes.FieldSmartPointerNode)1 AbstractTreeNode (com.intellij.ide.util.treeView.AbstractTreeNode)1 Project (com.intellij.openapi.project.Project)1 PsiElement (com.intellij.psi.PsiElement)1 PsiField (com.intellij.psi.PsiField)1 ArrayList (java.util.ArrayList)1