Java Code Examples for com.intellij.openapi.editor.markup.TextAttributes#getEffectColor()
The following examples show how to use
com.intellij.openapi.editor.markup.TextAttributes#getEffectColor() .
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: NavigationUtil.java From consulo with Apache License 2.0 | 6 votes |
/** * Patches attributes to be visible under debugger active line */ @SuppressWarnings("UseJBColor") public static TextAttributes patchAttributesColor(TextAttributes attributes, @Nonnull TextRange range, @Nonnull Editor editor) { if (attributes.getForegroundColor() == null && attributes.getEffectColor() == null) return attributes; MarkupModel model = DocumentMarkupModel.forDocument(editor.getDocument(), editor.getProject(), false); if (model != null) { if (!((MarkupModelEx)model).processRangeHighlightersOverlappingWith(range.getStartOffset(), range.getEndOffset(), highlighter -> { if (highlighter.isValid() && highlighter.getTargetArea() == HighlighterTargetArea.LINES_IN_RANGE) { TextAttributes textAttributes = highlighter.getTextAttributes(); if (textAttributes != null) { Color color = textAttributes.getBackgroundColor(); return !(color != null && color.getBlue() > 128 && color.getRed() < 128 && color.getGreen() < 128); } } return true; })) { TextAttributes clone = attributes.clone(); clone.setForegroundColor(Color.orange); clone.setEffectColor(Color.orange); return clone; } } return attributes; }
Example 2
Source File: FlutterLogView.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void computeTextAttributesByLogLevelCache() { final EditorColorsScheme globalEditorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme(); textAttributesByLogLevelCache.clear(); for (Level level : FlutterLog.Level.values()) { try { final TextAttributesKey key = LOG_LEVEL_TEXT_ATTRIBUTES_KEY_MAP.get(level); final TextAttributes attributes = globalEditorColorsScheme.getAttributes(key); int fontType = attributes.getFontType(); final Color effectColor = attributes.getEffectColor(); final Integer textStyle = EFFECT_TYPE_TEXT_STYLE_MAP.get(attributes.getEffectType()); // TextStyle can exist even when unchecked in settings page. // only effectColor is null when setting effect is unchecked in setting page. // So, we have to check that both effectColor & textStyle are not null. if (effectColor != null && textStyle != null) { fontType = fontType | textStyle; } final SimpleTextAttributes textAttributes = new SimpleTextAttributes( attributes.getBackgroundColor(), attributes.getForegroundColor(), effectColor, fontType ); textAttributesByLogLevelCache.put(level, textAttributes); } catch (Exception e) { // Should never go here. FlutterUtils.warn(LOG, "Error when get text attributes by log level", e); } } }
Example 3
Source File: FlutterLogView.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void computeTextAttributesByLogLevelCache() { final EditorColorsScheme globalEditorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme(); textAttributesByLogLevelCache.clear(); for (Level level : FlutterLog.Level.values()) { try { final TextAttributesKey key = LOG_LEVEL_TEXT_ATTRIBUTES_KEY_MAP.get(level); final TextAttributes attributes = globalEditorColorsScheme.getAttributes(key); int fontType = attributes.getFontType(); final Color effectColor = attributes.getEffectColor(); final Integer textStyle = EFFECT_TYPE_TEXT_STYLE_MAP.get(attributes.getEffectType()); // TextStyle can exist even when unchecked in settings page. // only effectColor is null when setting effect is unchecked in setting page. // So, we have to check that both effectColor & textStyle are not null. if (effectColor != null && textStyle != null) { fontType = fontType | textStyle; } final SimpleTextAttributes textAttributes = new SimpleTextAttributes( attributes.getBackgroundColor(), attributes.getForegroundColor(), effectColor, fontType ); textAttributesByLogLevelCache.put(level, textAttributes); } catch (Exception e) { // Should never go here. FlutterUtils.warn(LOG, "Error when get text attributes by log level", e); } } }
Example 4
Source File: HighlightDisplayLevel.java From consulo with Apache License 2.0 | 5 votes |
@Nullable public Color getColorInner() { final EditorColorsManager manager = EditorColorsManager.getInstance(); if (manager != null) { TextAttributes attributes = manager.getGlobalScheme().getAttributes(myKey); Color stripe = attributes.getErrorStripeColor(); if (stripe != null) return stripe; return attributes.getEffectColor(); } TextAttributes defaultAttributes = myKey.getDefaultAttributes(); if (defaultAttributes == null) defaultAttributes = TextAttributes.ERASE_MARKER; return defaultAttributes.getErrorStripeColor(); }
Example 5
Source File: SimpleTextAttributes.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public static SimpleTextAttributes fromTextAttributes(TextAttributes attributes) { if (attributes == null) return REGULAR_ATTRIBUTES; Color foregroundColor = attributes.getForegroundColor(); if (foregroundColor == null) foregroundColor = REGULAR_ATTRIBUTES.getFgColor(); int style = attributes.getFontType(); if (attributes.getEffectColor() != null) { EffectType effectType = attributes.getEffectType(); if (effectType == EffectType.STRIKEOUT) { style |= STYLE_STRIKEOUT; } else if (effectType == EffectType.WAVE_UNDERSCORE) { style |= STYLE_WAVED; } else if (effectType == EffectType.LINE_UNDERSCORE || effectType == EffectType.BOLD_LINE_UNDERSCORE || effectType == EffectType.BOLD_DOTTED_LINE) { style |= STYLE_UNDERLINE; } else if (effectType == EffectType.SEARCH_MATCH) { style |= STYLE_SEARCH_MATCH; } else { // not supported } } return new SimpleTextAttributes(attributes.getBackgroundColor(), foregroundColor, attributes.getEffectColor(), style); }
Example 6
Source File: LineExtensionInfo.java From consulo with Apache License 2.0 | 5 votes |
public LineExtensionInfo(@Nonnull String text, @Nonnull TextAttributes attr) { myText = text; myColor = attr.getForegroundColor(); myEffectType = attr.getEffectType(); myEffectColor = attr.getEffectColor(); myFontType = attr.getFontType(); myBgColor = attr.getBackgroundColor(); }
Example 7
Source File: InlineElementData.java From consulo with Apache License 2.0 | 5 votes |
@Override public void paint(@Nonnull Inlay inlay, @Nonnull Graphics g, @Nonnull Rectangle r, @Nonnull TextAttributes textAttributes) { myDelegate.paint(inlay, g, r, textAttributes); if (drawBorder) { TextAttributes attributes = inlay.getEditor().getColorsScheme().getAttributes(BLINKING_HIGHLIGHTS_ATTRIBUTES); if (attributes != null && attributes.getEffectColor() != null) { g.setColor(attributes.getEffectColor()); g.drawRect(r.x, r.y, r.width, r.height); } } }
Example 8
Source File: Breadcrumbs.java From consulo with Apache License 2.0 | 4 votes |
protected Color getEffectColor(Crumb crumb) { TextAttributes attributes = getAttributes(crumb); return attributes == null ? null : attributes.getEffectColor(); }
Example 9
Source File: ImmediatePainter.java From consulo with Apache License 2.0 | 4 votes |
private static boolean canRender(final TextAttributes attributes) { return attributes.getEffectType() != EffectType.BOXED || attributes.getEffectColor() == null; }