Search in sources :

Example 1 with ModifiableCellAppearanceEx

use of com.intellij.openapi.roots.ui.ModifiableCellAppearanceEx in project intellij-community by JetBrains.

the class StructureNodeRenderer method forNodeDescriptorInTree.

public static CellAppearanceEx forNodeDescriptorInTree(Object node, boolean expanded) {
    NodeDescriptor descriptor = getNodeDescriptor(node);
    if (descriptor == null)
        return FileAppearanceService.getInstance().empty();
    String name = descriptor.toString();
    Object psiElement = descriptor.getElement();
    ModifiableCellAppearanceEx result;
    if (psiElement instanceof PsiElement && !((PsiElement) psiElement).isValid()) {
        result = CompositeAppearance.single(name);
    } else {
        PsiClass psiClass = getContainingClass(psiElement);
        if (isInheritedMember(node, psiClass) && psiClass != null) {
            CompositeAppearance.DequeEnd ending = new CompositeAppearance().getEnding();
            ending.addText(name, applyDeprecation(psiElement, SimpleTextAttributes.DARK_TEXT));
            ending.addComment(psiClass.getName(), applyDeprecation(psiClass, SimpleTextAttributes.GRAY_ATTRIBUTES));
            result = ending.getAppearance();
        } else {
            SimpleTextAttributes textAttributes = applyDeprecation(psiElement, SimpleTextAttributes.REGULAR_ATTRIBUTES);
            result = CompositeAppearance.single(name, textAttributes);
        }
    }
    result.setIcon(descriptor.getIcon());
    return result;
}
Also used : ModifiableCellAppearanceEx(com.intellij.openapi.roots.ui.ModifiableCellAppearanceEx) SimpleTextAttributes(com.intellij.ui.SimpleTextAttributes) NodeDescriptor(com.intellij.ide.util.treeView.NodeDescriptor) PsiClass(com.intellij.psi.PsiClass) CompositeAppearance(com.intellij.openapi.roots.ui.util.CompositeAppearance) PsiElement(com.intellij.psi.PsiElement)

Aggregations

NodeDescriptor (com.intellij.ide.util.treeView.NodeDescriptor)1 ModifiableCellAppearanceEx (com.intellij.openapi.roots.ui.ModifiableCellAppearanceEx)1 CompositeAppearance (com.intellij.openapi.roots.ui.util.CompositeAppearance)1 PsiClass (com.intellij.psi.PsiClass)1 PsiElement (com.intellij.psi.PsiElement)1 SimpleTextAttributes (com.intellij.ui.SimpleTextAttributes)1