Java Code Examples for com.intellij.ui.SimpleTextAttributes#fromTextAttributes()
The following examples show how to use
com.intellij.ui.SimpleTextAttributes#fromTextAttributes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NodeRenderer.java From consulo with Apache License 2.0 | 5 votes |
private SimpleTextAttributes addColorToSimpleTextAttributes(SimpleTextAttributes simpleTextAttributes, Color color) { if (color != null) { final TextAttributes textAttributes = simpleTextAttributes.toTextAttributes(); textAttributes.setForegroundColor(color); simpleTextAttributes = SimpleTextAttributes.fromTextAttributes(textAttributes); } return simpleTextAttributes; }
Example 2
Source File: NodeRenderer.java From consulo with Apache License 2.0 | 5 votes |
public static SimpleTextAttributes getSimpleTextAttributes(@Nullable final ItemPresentation presentation, @Nonnull EditorColorsScheme colorsScheme) { if (presentation instanceof ColoredItemPresentation) { final TextAttributesKey textAttributesKey = ((ColoredItemPresentation) presentation).getTextAttributesKey(); if (textAttributesKey == null) return SimpleTextAttributes.REGULAR_ATTRIBUTES; final TextAttributes textAttributes = colorsScheme.getAttributes(textAttributesKey); return textAttributes == null ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.fromTextAttributes(textAttributes); } return SimpleTextAttributes.REGULAR_ATTRIBUTES; }
Example 3
Source File: XValueTextRendererImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public void renderStringValue(@Nonnull String value, @Nullable String additionalSpecialCharsToHighlight, char quoteChar, int maxLength) { TextAttributes textAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DefaultLanguageHighlighterColors.STRING); SimpleTextAttributes attributes = SimpleTextAttributes.fromTextAttributes(textAttributes); myText.append(String.valueOf(quoteChar), attributes); XValuePresentationUtil.renderValue(value, myText, attributes, maxLength, additionalSpecialCharsToHighlight); myText.append(String.valueOf(quoteChar), attributes); }
Example 4
Source File: XValueTextRendererImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override protected void renderRawValue(@Nonnull String value, @Nonnull TextAttributesKey key) { TextAttributes textAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(key); SimpleTextAttributes attributes = SimpleTextAttributes.fromTextAttributes(textAttributes); myText.append(value, attributes); }
Example 5
Source File: PackagingElementNode.java From consulo with Apache License 2.0 | 4 votes |
private static SimpleTextAttributes addErrorHighlighting(boolean error, SimpleTextAttributes attributes) { final TextAttributes textAttributes = attributes.toTextAttributes(); textAttributes.setEffectType(EffectType.WAVE_UNDERSCORE); textAttributes.setEffectColor(error ? JBColor.RED : JBColor.GRAY); return SimpleTextAttributes.fromTextAttributes(textAttributes); }