Search in sources :

Example 1 with TreeElementWrapper

use of com.intellij.ide.util.treeView.smartTree.TreeElementWrapper in project intellij-community by JetBrains.

the class ResourceBundleEditorRenderer method customize.

private boolean customize(Object value) {
    final Object userObject = ((DefaultMutableTreeNode) value).getUserObject();
    if (!(userObject instanceof TreeElementWrapper)) {
        return false;
    }
    final TreeElement treeElement = ((TreeElementWrapper) userObject).getValue();
    if (treeElement == null) {
        return false;
    }
    final ItemPresentation presentation = treeElement.getPresentation();
    if (presentation instanceof TextAttributesPresentation) {
        final TextAttributesPresentation textAttributesPresentation = (TextAttributesPresentation) presentation;
        final String text = textAttributesPresentation.getPresentableText();
        if (text != null) {
            final SimpleTextAttributes attr = SimpleTextAttributes.fromTextAttributes(textAttributesPresentation.getTextAttributes(getColorsScheme()));
            append(text, new SimpleTextAttributes(attr.getBgColor(), attr.getFgColor(), attr.getWaveColor(), attr.getStyle() | SimpleTextAttributes.STYLE_OPAQUE));
            return true;
        }
    }
    return false;
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) TreeElementWrapper(com.intellij.ide.util.treeView.smartTree.TreeElementWrapper) SimpleTextAttributes(com.intellij.ui.SimpleTextAttributes) ItemPresentation(com.intellij.navigation.ItemPresentation) TreeElement(com.intellij.ide.util.treeView.smartTree.TreeElement)

Aggregations

TreeElement (com.intellij.ide.util.treeView.smartTree.TreeElement)1 TreeElementWrapper (com.intellij.ide.util.treeView.smartTree.TreeElementWrapper)1 ItemPresentation (com.intellij.navigation.ItemPresentation)1 SimpleTextAttributes (com.intellij.ui.SimpleTextAttributes)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1