Search in sources :

Example 1 with ClassSmartPointerNode

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

the class PsiClassFavoriteNodeProvider 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 PsiClass && checkClassUnderSources(element, project)) {
                result.add(new ClassSmartPointerNode(project, element, viewSettings));
            }
        }
        return result.isEmpty() ? null : result;
    }
    return null;
}
Also used : Project(com.intellij.openapi.project.Project) ClassSmartPointerNode(com.intellij.ide.favoritesTreeView.smartPointerPsiNodes.ClassSmartPointerNode) ArrayList(java.util.ArrayList) PsiClass(com.intellij.psi.PsiClass) AbstractTreeNode(com.intellij.ide.util.treeView.AbstractTreeNode) PsiElement(com.intellij.psi.PsiElement)

Aggregations

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