本文整理汇总了Java中com.intellij.openapi.editor.markup.TextAttributes.getForegroundColor方法的典型用法代码示例。如果您正苦于以下问题:Java TextAttributes.getForegroundColor方法的具体用法?Java TextAttributes.getForegroundColor怎么用?Java TextAttributes.getForegroundColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.editor.markup.TextAttributes
的用法示例。
在下文中一共展示了TextAttributes.getForegroundColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUI
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
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<HighlightSeverity, Map<SimpleTextAttributes, SimpleTextAttributes>>();
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, Color.RED);
}
示例2: paint
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
public void paint(Editor editor, Graphics g, Rectangle r) {
final TextAttributes color = editor.getColorsScheme().getAttributes(myKey);
Color bgColor = color.getBackgroundColor();
if (bgColor == null) {
bgColor = color.getForegroundColor();
}
if (editor.getSettings().isLineNumbersShown() || ((EditorGutterComponentEx)editor.getGutter()).isAnnotationsShown()) {
if (bgColor != null) {
bgColor = ColorUtil.toAlpha(bgColor, 150);
}
}
if (bgColor != null) {
g.setColor(bgColor);
}
g.fillRect(r.x, r.y, r.width, r.height);
final LineData lineData = getLineData(editor.xyToLogicalPosition(new Point(0, r.y)).line);
if (lineData != null && lineData.isCoveredByOneTest()) {
g.drawImage( ImageLoader.loadFromResource("/gutter/unique.png"), r.x, r.y, 8, 8, editor.getComponent());
}
}
示例3: getNormalAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
private static TextAttributes getNormalAttributes() {
TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.INLINED_VALUES);
if (attributes == null || attributes.getForegroundColor() == null) {
return new TextAttributes(new JBColor(Gray._135, new Color(0x3d8065)), null, null, null, Font.ITALIC);
}
return attributes;
}
示例4: errorColor
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
public static Color errorColor() {
TextAttributes attribute = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.ERRORS_ATTRIBUTES);
Color color = JBColor.RED;
if (attribute != null) {
if (attribute.getForegroundColor() != null) {
color = attribute.getForegroundColor();
} else if (attribute.getEffectColor() != null) {
color = attribute.getEffectColor();
} else if (attribute.getErrorStripeColor() != null) {
color = attribute.getErrorStripeColor();
}
}
return color;
}
示例5: warningColor
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
public static Color warningColor() {
TextAttributes attribute = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.WARNINGS_ATTRIBUTES);
Color color = JBColor.ORANGE;
if (attribute != null) {
if (attribute.getForegroundColor() != null) {
color = attribute.getForegroundColor();
} else if (attribute.getEffectColor() != null) {
color = attribute.getEffectColor();
} else if (attribute.getErrorStripeColor() != null) {
color = attribute.getErrorStripeColor();
}
}
return color;
}
示例6: getAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
@Nullable
private static TextAttributes getAttributes(@NotNull EditorColorsScheme scheme, @NotNull TextAttributesKey ... keys) {
TextAttributes result = null;
for (TextAttributesKey key : keys) {
TextAttributes attributes = scheme.getAttributes(key);
if (attributes == null) {
continue;
}
if (result == null) {
result = attributes;
}
Color currentForegroundColor = result.getForegroundColor();
if (currentForegroundColor == null) {
result.setForegroundColor(attributes.getForegroundColor());
}
Color currentBackgroundColor = result.getBackgroundColor();
if (currentBackgroundColor == null) {
result.setBackgroundColor(attributes.getBackgroundColor());
}
if (result.getForegroundColor() != null && result.getBackgroundColor() != null) {
return result;
}
}
if (result != null && result.getForegroundColor() == null) {
return null;
}
if (result != null && result.getBackgroundColor() == null) {
result.setBackgroundColor(scheme.getDefaultBackground());
}
return result;
}
示例7: fromTextAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
@NotNull
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);
}
示例8: LineExtensionInfo
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
public LineExtensionInfo(@NotNull String text, @NotNull TextAttributes attr) {
myText = text;
myColor = attr.getForegroundColor();
myEffectType = attr.getEffectType();
myEffectColor = attr.getEffectColor();
myFontType = attr.getFontType();
}
示例9: compare
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
@Override
public int compare(RangeHighlighterEx o1, RangeHighlighterEx o2) {
final int result = LayerComparator.INSTANCE.compare(o1, o2);
if (result != 0) {
return result;
}
// There is a possible case when more than one highlighter target the same region (e.g. 'identifier under caret' and 'identifier').
// We want to prefer the one that defines foreground color to the one that doesn't define (has either fore- or background colors
// while the other one has only foreground color). See IDEA-85697 for concrete example.
final TextAttributes a1 = o1.getTextAttributes();
final TextAttributes a2 = o2.getTextAttributes();
if (a1 == null ^ a2 == null) {
return a1 == null ? 1 : -1;
}
if (a1 == null) {
return result;
}
final Color fore1 = a1.getForegroundColor();
final Color fore2 = a2.getForegroundColor();
if (fore1 == null ^ fore2 == null) {
return fore1 == null ? 1 : -1;
}
final Color back1 = a1.getBackgroundColor();
final Color back2 = a2.getBackgroundColor();
if (back1 == null ^ back2 == null) {
return back1 == null ? 1 : -1;
}
return result;
}
示例10: compare
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
@Override
public int compare(RangeHighlighterEx o1, RangeHighlighterEx o2) {
final int result = LayerComparator.INSTANCE.compare(o1, o2);
if (result != 0) {
return result;
}
// There is a possible case when more than one highlighter target the same region (e.g. 'identifier under caret' and 'identifier').
// We want to prefer the one that defines foreground color to the one that doesn't define (has either fore- or background colors
// while the other one has only foreground color). See IDEA-85697 for concrete example.
final TextAttributes a1 = o1.getTextAttributes();
final TextAttributes a2 = o2.getTextAttributes();
if (a1 == null ^ a2 == null) {
return a1 == null ? 1 : -1;
}
if (a1 == null) {
return result;
}
final Color fore1 = a1.getForegroundColor();
final Color fore2 = a2.getForegroundColor();
if (fore1 == null ^ fore2 == null) {
return fore1 == null ? 1 : -1;
}
final Color back1 = a1.getBackgroundColor();
final Color back2 = a2.getBackgroundColor();
if (back1 == null ^ back2 == null) {
return back1 == null ? 1 : -1;
}
return result;
}
示例11: getNormalAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
public static TextAttributes getNormalAttributes() {
TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.INLINED_VALUES);
if (attributes == null || attributes.getForegroundColor() == null) {
return new TextAttributes(new JBColor(new NotNullProducer<Color>() {
@SuppressWarnings("UseJBColor")
@NotNull
@Override
public Color produce() {
return isDarkEditor() ? new Color(0x3d8065) : Gray._135;
}
}), null, null, null, Font.ITALIC);
}
return attributes;
}
示例12: getChangedAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
public static TextAttributes getChangedAttributes() {
TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.INLINED_VALUES_MODIFIED);
if (attributes == null || attributes.getForegroundColor() == null) {
return new TextAttributes(new JBColor(new NotNullProducer<Color>() {
@SuppressWarnings("UseJBColor")
@NotNull
@Override
public Color produce() {
return isDarkEditor() ? new Color(0xa1830a) : new Color(0xca8021);
}
}), null, null, null, Font.ITALIC);
}
return attributes;
}
示例13: getTopFrameSelectedAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
private static TextAttributes getTopFrameSelectedAttributes() {
TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.INLINED_VALUES_EXECUTION_LINE);
if (attributes == null || attributes.getForegroundColor() == null) {
//noinspection UseJBColor
return new TextAttributes(isDarkEditor() ? new Color(255, 235, 9) : new Color(0, 255, 86), null, null, null, Font.ITALIC);
}
return attributes;
}
示例14: advance
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
public void advance() {
if (mySegmentIterator.atEnd()) {
myRangeIterator.advance();
TextAttributes textAttributes = myRangeIterator.getTextAttributes();
myCurrentFontStyle = textAttributes == null ? Font.PLAIN : textAttributes.getFontType();
myCurrentForegroundColor = textAttributes == null ? null : textAttributes.getForegroundColor();
myCurrentBackgroundColor = textAttributes == null ? null : textAttributes.getBackgroundColor();
mySegmentIterator.reset(myRangeIterator.getRangeStart(), myRangeIterator.getRangeEnd(), myCurrentFontStyle);
}
mySegmentIterator.advance();
}
示例15: getNormalAttributes
import com.intellij.openapi.editor.markup.TextAttributes; //导入方法依赖的package包/类
public static TextAttributes getNormalAttributes() {
TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.INLINED_VALUES);
if (attributes == null || attributes.getForegroundColor() == null) {
return new TextAttributes(new JBColor(() -> isDarkEditor() ? new Color(0x3d8065) : Gray._135), null, null, null, Font.ITALIC);
}
return attributes;
}