void (@NotNull JTree tree, @NlsSafe Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { @NlsSafe Object node = TreeUtil.getUserObject(value); if (node instanceof NodeDescriptor<?> descriptor) { // TODO: use this color somewhere Color color = descriptor.getColor(); setIcon(fixIconIfNeeded(descriptor.getIcon(), selected, hasFocus)); } ItemPresentation p0 = getPresentation(node); if (p0 instanceof PresentationData presentation) { Color color = node instanceof NodeDescriptor ? ((NodeDescriptor<?>)node).getColor() : null; setIcon(fixIconIfNeeded(presentation.getIcon(false), selected, hasFocus)); final List<PresentableNodeDescriptor.ColoredFragment> coloredText = presentation.getColoredText(); Color forcedForeground = presentation.getForcedTextForeground(); if (coloredText.isEmpty()) { String text = presentation.getPresentableText(); if (StringUtil.isEmpty(text)) { @NlsSafe String valueSting = value.toString(); text = valueSting; } text = tree.convertValueToText(text, selected, expanded, leaf, row, hasFocus); SimpleTextAttributes simpleTextAttributes = getSimpleTextAttributes( presentation, forcedForeground != null ? forcedForeground : color, node); append(text, simpleTextAttributes); String location = presentation.getLocationString(); if (!StringUtil.isEmpty(location)) { SimpleTextAttributes attributes = SimpleTextAttributes.merge(simpleTextAttributes, SimpleTextAttributes.GRAYED_ATTRIBUTES); append(presentation.getLocationPrefix() + location + presentation.getLocationSuffix(), attributes, false); } } else { boolean first = true; boolean isMain = true; for (PresentableNodeDescriptor.ColoredFragment each : coloredText) { SimpleTextAttributes simpleTextAttributes = each.getAttributes(); if (each.getAttributes().getFgColor() == null && forcedForeground != null) { simpleTextAttributes = addColorToSimpleTextAttributes(each.getAttributes(), forcedForeground); } if (first) { final TextAttributesKey textAttributesKey = presentation.getTextAttributesKey(); if (textAttributesKey != null) { TextAttributes forcedAttributes = getScheme().getAttributes(textAttributesKey); if (forcedAttributes != null) { simpleTextAttributes = SimpleTextAttributes.merge(simpleTextAttributes, SimpleTextAttributes.fromTextAttributes(forcedAttributes)); } } first = false; } // the first grayed text (inactive foreground, regular or small) ends main speed-searchable text isMain = isMain && !Comparing.equal(simpleTextAttributes.getFgColor(), SimpleTextAttributes.GRAYED_ATTRIBUTES.getFgColor()); append(each.getText(), simpleTextAttributes, isMain); } String location = presentation.getLocationString(); if (!StringUtil.isEmpty(location)) { append(presentation.getLocationPrefix() + location + presentation.getLocationSuffix(), SimpleTextAttributes.GRAYED_ATTRIBUTES, false); } } setToolTipText(presentation.getTooltip()); } else if (value != null) { @NlsSafe String text = value.toString(); if (node instanceof NodeDescriptor) { text = node.toString(); } text = tree.convertValueToText(text, selected, expanded, leaf, row, hasFocus); if (text == null) { text = ""; } append(text); setToolTipText(null); } }