use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class SimpleNode method setNodeText.
/**
* @deprecated use {@link #getTemplatePresentation()} to set constant presentation right in node's constructor
* or update presentation dynamically by defining {@link #update(com.intellij.ide.projectView.PresentationData)}
*/
public final void setNodeText(String text, String tooltip, boolean hasError) {
clearColoredText();
SimpleTextAttributes attributes = hasError ? getErrorAttributes() : getPlainAttributes();
getTemplatePresentation().addText(new ColoredFragment(text, tooltip, attributes));
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class ComponentRenderer method renderComponent.
private void renderComponent(@Nullable final RadComponent target, boolean selected) {
clear();
final SimpleTextAttributes baseAttributes = selected ? SimpleTextAttributes.SELECTED_SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES;
if (target == null) {
append(UIDesignerBundle.message("component.none"), baseAttributes);
return;
}
setIcon(ComponentTree.getComponentIcon(target));
String binding = target.getBinding();
if (binding != null) {
append(binding, baseAttributes);
} else {
final String componentTitle = target.getComponentTitle();
if (componentTitle != null && componentTitle.length() > "\"\"".length()) {
append(componentTitle, baseAttributes);
} else {
append(target.getComponentClass().getSimpleName(), selected ? SimpleTextAttributes.SELECTED_SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
}
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class Cvs2Renderer method customizeCellRenderer.
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
if (value instanceof CvsElement) {
final CvsElement element = (CvsElement) value;
append(value.toString(), new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getTreeForeground()));
if (element.isLoading()) {
append(" (Loading...)", new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getInactiveTextColor()));
}
setIcon(element.getIcon());
} else if (value instanceof LoadingNode) {
setIcon(((LoadingNode) value).getIcon());
append(value.toString(), new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getInactiveTextColor()));
}
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class ComponentTree method setUI.
public void setUI(final TreeUI ui) {
super.setUI(ui);
// [vova] we cannot create this hash in constructor and just clear it here. The
// problem is that setUI is invoked by constructor of superclass.
myHighlightAttributes = new HashMap<>();
final EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
final TextAttributes attributes = globalScheme.getAttributes(JavaHighlightingColors.STRING);
myBindingAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, UIUtil.getTreeForeground());
myClassAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getTreeForeground());
myPackageAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, Color.GRAY);
myTitleAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, attributes.getForegroundColor());
myUnknownAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_WAVED, JBColor.RED);
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class ComponentTree method getAttribute.
private SimpleTextAttributes getAttribute(@NotNull final SimpleTextAttributes attrs, @Nullable HighlightDisplayLevel level) {
if (level == null) {
return attrs;
}
Map<SimpleTextAttributes, SimpleTextAttributes> highlightMap = myHighlightAttributes.get(level.getSeverity());
if (highlightMap == null) {
highlightMap = new HashMap<>();
myHighlightAttributes.put(level.getSeverity(), highlightMap);
}
SimpleTextAttributes result = highlightMap.get(attrs);
if (result == null) {
final TextAttributesKey attrKey = SeverityRegistrar.getSeverityRegistrar(myProject).getHighlightInfoTypeBySeverity(level.getSeverity()).getAttributesKey();
TextAttributes textAttrs = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(attrKey);
textAttrs = TextAttributes.merge(attrs.toTextAttributes(), textAttrs);
result = SimpleTextAttributes.fromTextAttributes(textAttrs);
highlightMap.put(attrs, result);
}
return result;
}
Aggregations