當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleTextAttributes.fromTextAttributes方法代碼示例

本文整理匯總了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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:ComponentTree.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:NodeRenderer.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:NodeRenderer.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:XValueTextRendererImpl.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:ComponentTree.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:PackagingElementNode.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:XValueTextRendererImpl.java


注:本文中的com.intellij.ui.SimpleTextAttributes.fromTextAttributes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。