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


Java TextAttributes.getEffectType方法代碼示例

本文整理匯總了Java中com.intellij.openapi.editor.markup.TextAttributes.getEffectType方法的典型用法代碼示例。如果您正苦於以下問題:Java TextAttributes.getEffectType方法的具體用法?Java TextAttributes.getEffectType怎麽用?Java TextAttributes.getEffectType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.editor.markup.TextAttributes的用法示例。


在下文中一共展示了TextAttributes.getEffectType方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

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

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

示例3: equals

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
@Override
public boolean equals(final TextAttributes attributes1, final TextAttributes attributes2) {
  Color effectColor = attributes1.getEffectColor();
  EffectType effectType = attributes1.getEffectType();
  return effectColor != null
         && effectColor.equals(attributes2.getEffectColor())
         && (EffectType.BOXED == effectType || EffectType.ROUNDED_BOX == effectType) &&
         effectType == attributes2.getEffectType();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:BorderEffect.java

示例4: NamedTextAttr

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
public NamedTextAttr(@NotNull String name, @NotNull TextAttributes ta) {
    super(ta.getForegroundColor(), ta.getBackgroundColor(), ta.getEffectColor(),
            ta.getEffectType(), ta.getFontType());
    setErrorStripeColor(ta.getErrorStripeColor());
    this.name = name;
}
 
開發者ID:huoguangjin,項目名稱:MultiHighlight,代碼行數:7,代碼來源:NamedTextAttr.java

示例5: getOutputKey

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
@NotNull
public Key getOutputKey(@NonNls String attribute) {
  final String completeAttribute = attribute;
  if (attribute.startsWith("\u001B[")) {
    attribute = attribute.substring(2);
  }
  else if (attribute.startsWith("[")) {
    attribute = attribute.substring(1);
  }
  if (attribute.endsWith("m")) {
    attribute = attribute.substring(0, attribute.length() - 1);
  }
  if (attribute.equals("0")) {
    return ProcessOutputTypes.STDOUT;
  }
  TextAttributes attrs = new TextAttributes();
  final String[] strings = attribute.split(";");
  for (String string : strings) {
    int value;
    try {
      value = Integer.parseInt(string);
    }
    catch (NumberFormatException e) {
      continue;
    }
    if (value == 1) {
      attrs.setFontType(Font.BOLD);
    }
    else if (value == 4) {
      attrs.setEffectType(EffectType.LINE_UNDERSCORE);
    }
    else if (value == 22) {
      attrs.setFontType(Font.PLAIN);
    }
    else if (value == 24) {  //not underlined
      attrs.setEffectType(null);
    }
    else if (value >= 30 && value <= 37) {
      attrs.setForegroundColor(getAnsiColor(value - 30));
    }
    else if (value == 38) {
      //TODO: 256 colors foreground
    }
    else if (value == 39) {
      attrs.setForegroundColor(getColorByKey(ConsoleViewContentType.NORMAL_OUTPUT_KEY));
    }
    else if (value >= 40 && value <= 47) {
      attrs.setBackgroundColor(getAnsiColor(value - 40));
    }
    else if (value == 48) {
      //TODO: 256 colors background
    }
    else if (value == 49) {
      attrs.setBackgroundColor(getColorByKey(ConsoleViewContentType.NORMAL_OUTPUT_KEY));
    }
    else if (value >= 90 && value <= 97) {
      attrs.setForegroundColor(
        getAnsiColor(value - 82));
    }
    else if (value >= 100 && value <= 107) {
      attrs.setBackgroundColor(
        getAnsiColor(value - 92));
    }
  }
  if (attrs.getEffectType() == EffectType.LINE_UNDERSCORE) {
    attrs.setEffectColor(attrs.getForegroundColor());
  }
  Key newKey = new Key(completeAttribute);
  ConsoleViewContentType contentType = new ConsoleViewContentType(completeAttribute, attrs);
  ConsoleViewContentType.registerNewConsoleViewType(newKey, contentType);
  return newKey;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:73,代碼來源:ColoredOutputTypeRegistry.java

示例6: isBorder

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private static boolean isBorder(TextAttributes textAttributes) {
  return textAttributes != null &&
         textAttributes.getEffectColor() != null &&
         (EffectType.BOXED == textAttributes.getEffectType() || EffectType.ROUNDED_BOX == textAttributes.getEffectType());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:BorderEffect.java


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