本文整理匯總了Java中com.intellij.ui.SimpleTextAttributes.fromTextAttributes方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleTextAttributes.fromTextAttributes方法的具體用法?Java SimpleTextAttributes.fromTextAttributes怎麽用?Java SimpleTextAttributes.fromTextAttributes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.ui.SimpleTextAttributes
的用法示例。
在下文中一共展示了SimpleTextAttributes.fromTextAttributes方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAttribute
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
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<SimpleTextAttributes, SimpleTextAttributes>();
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;
}
示例2: addColorToSimpleTextAttributes
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
private static SimpleTextAttributes addColorToSimpleTextAttributes(SimpleTextAttributes simpleTextAttributes, Color color) {
if (color != null) {
final TextAttributes textAttributes = simpleTextAttributes.toTextAttributes();
textAttributes.setForegroundColor(color);
simpleTextAttributes = SimpleTextAttributes.fromTextAttributes(textAttributes);
}
return simpleTextAttributes;
}
示例3: getSimpleTextAttributes
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
public static SimpleTextAttributes getSimpleTextAttributes(@Nullable final ItemPresentation presentation,
@NotNull 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;
}
示例4: renderStringValue
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
@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);
}
示例5: getAttributeWrapper
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
private AttributeWrapper getAttributeWrapper(RadComponent component) {
AttributeWrapper wrapper = AttributeWrapper.DEFAULT;
final HighlightDisplayLevel level = getHighlightDisplayLevel(myDesigner.getProject(), component);
if (level != null) {
TextAttributesKey attributesKey =
SeverityRegistrar.getSeverityRegistrar(myDesigner.getProject()).getHighlightInfoTypeBySeverity(level.getSeverity())
.getAttributesKey();
final TextAttributes textAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(attributesKey);
wrapper = new AttributeWrapper() {
@Override
public SimpleTextAttributes getAttribute(SimpleTextAttributes attributes) {
Color bgColor = textAttributes.getBackgroundColor();
try {
textAttributes.setBackgroundColor(null);
return SimpleTextAttributes.fromTextAttributes(TextAttributes.merge(attributes.toTextAttributes(), textAttributes));
}
finally {
textAttributes.setBackgroundColor(bgColor);
}
}
};
}
return wrapper;
}
示例6: addErrorHighlighting
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
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);
}
示例7: renderRawValue
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
@Override
protected void renderRawValue(@NotNull String value, @NotNull TextAttributesKey key) {
TextAttributes textAttributes = DebuggerUIUtil.getColorScheme().getAttributes(key);
SimpleTextAttributes attributes = SimpleTextAttributes.fromTextAttributes(textAttributes);
myText.append(value, attributes);
}