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; }
public static SimpleTextAttributes patchAttr( InspectionTreeNode node, SimpleTextAttributes attributes) { if (node.isResolved()) { return new SimpleTextAttributes( attributes.getBgColor(), attributes.getFgColor(), attributes.getWaveColor(), attributes.getStyle() | SimpleTextAttributes.STYLE_STRIKEOUT); } return attributes; }
void update() { clear(); setIcon(myIcon); final boolean focused = isFocusedOrPopupElement(); final boolean selected = isSelected(); setFocusBorderAroundIcon(false); setBackground(myUI.getBackground(selected, focused)); Color fg = myUI.getForeground(selected, focused, isInactive()); if (fg == null) fg = myAttributes.getFgColor(); final Color bg = getBackground(); append( myText, new SimpleTextAttributes(bg, fg, myAttributes.getWaveColor(), myAttributes.getStyle())); // repaint(); }