use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class UsageViewTreeCellRenderer method patchAttrs.
private static SimpleTextAttributes patchAttrs(@NotNull Node node, @NotNull SimpleTextAttributes original) {
if (node.isExcluded()) {
original = new SimpleTextAttributes(original.getStyle() | SimpleTextAttributes.STYLE_STRIKEOUT, original.getFgColor(), original.getWaveColor());
}
if (node instanceof GroupNode) {
UsageGroup group = ((GroupNode) node).getGroup();
FileStatus fileStatus = group != null ? group.getFileStatus() : null;
if (fileStatus != null && fileStatus != FileStatus.NOT_CHANGED) {
original = new SimpleTextAttributes(original.getStyle(), fileStatus.getColor(), original.getWaveColor());
}
DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent();
if (parent != null && parent.isRoot()) {
original = new SimpleTextAttributes(original.getStyle() | SimpleTextAttributes.STYLE_BOLD, original.getFgColor(), original.getWaveColor());
}
}
return original;
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class VirtualFileListCellRenderer method customizeCellRenderer.
@Override
protected void customizeCellRenderer(@NotNull JList list, Object value, int index, boolean selected, boolean hasFocus) {
final FilePath path = TreeModelBuilder.getPathForObject(value);
renderIcon(path);
final FileStatus fileStatus = myIgnoreFileStatus ? FileStatus.NOT_CHANGED : getStatus(value, path);
append(getName(path), new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, fileStatus.getColor(), null));
putParentPath(value, path, path);
setBackground(selected ? (hasFocus ? UIUtil.getListSelectionBackground() : UIUtil.getListUnfocusedSelectionBackground()) : UIUtil.getListBackground());
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class XValueNodeImpl method appendName.
private void appendName() {
if (!StringUtil.isEmpty(myName)) {
SimpleTextAttributes attributes = myChanged ? XDebuggerUIConstants.CHANGED_VALUE_ATTRIBUTES : XDebuggerUIConstants.VALUE_NAME_ATTRIBUTES;
XValuePresentationUtil.renderValue(myName, myText, attributes, MAX_NAME_LENGTH, null);
}
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class XValuePresentationUtil method renderValue.
public static void renderValue(@NotNull String value, @NotNull ColoredTextContainer text, @NotNull SimpleTextAttributes attributes, int maxLength, @Nullable String additionalCharsToEscape) {
SimpleTextAttributes escapeAttributes = null;
int lastOffset = 0;
int length = maxLength == -1 ? value.length() : Math.min(value.length(), maxLength);
for (int i = 0; i < length; i++) {
char ch = value.charAt(i);
int additionalCharIndex = -1;
if (ch == '\n' || ch == '\r' || ch == '\t' || ch == '\b' || ch == '\f' || (additionalCharsToEscape != null && (additionalCharIndex = additionalCharsToEscape.indexOf(ch)) != -1)) {
if (i > lastOffset) {
text.append(value.substring(lastOffset, i), attributes);
}
lastOffset = i + 1;
if (escapeAttributes == null) {
TextAttributes fromHighlighter = DebuggerUIUtil.getColorScheme().getAttributes(DefaultLanguageHighlighterColors.VALID_STRING_ESCAPE);
if (fromHighlighter != null) {
escapeAttributes = SimpleTextAttributes.fromTextAttributes(fromHighlighter);
} else {
escapeAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, JBColor.GRAY);
}
}
if (additionalCharIndex == -1) {
text.append("\\", escapeAttributes);
}
text.append(String.valueOf(getEscapingSymbol(ch)), escapeAttributes);
}
}
if (lastOffset < length) {
text.append(value.substring(lastOffset, length), attributes);
}
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class XValueTextRendererImpl method renderStringValue.
@Override
public void renderStringValue(@NotNull String value, @Nullable String additionalSpecialCharsToHighlight, int maxLength) {
TextAttributes textAttributes = DebuggerUIUtil.getColorScheme().getAttributes(DefaultLanguageHighlighterColors.STRING);
SimpleTextAttributes attributes = SimpleTextAttributes.fromTextAttributes(textAttributes);
myText.append("\"", attributes);
XValuePresentationUtil.renderValue(value, myText, attributes, maxLength, additionalSpecialCharsToHighlight);
myText.append("\"", attributes);
}
Aggregations