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


Java TextAttributes.setFontType方法代碼示例

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


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

示例1: processIntersectingRange

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private void processIntersectingRange(@NotNull UsageInfo2UsageAdapter usageInfo2UsageAdapter,
                                      @NotNull final CharSequence chars,
                                      int hiStart,
                                      final int hiEnd,
                                      @NotNull final TextAttributesKey[] tokenHighlights,
                                      final boolean selectUsageWithBold,
                                      @NotNull final List<TextChunk> result) {
  final TextAttributes originalAttrs = convertAttributes(tokenHighlights);
  if (selectUsageWithBold) {
    originalAttrs.setFontType(Font.PLAIN);
  }

  final int[] lastOffset = {hiStart};
  usageInfo2UsageAdapter.processRangeMarkers(new Processor<Segment>() {
    @Override
    public boolean process(Segment segment) {
      int usageStart = segment.getStartOffset();
      int usageEnd = segment.getEndOffset();
      if (rangeIntersect(lastOffset[0], hiEnd, usageStart, usageEnd)) {
        addChunk(chars, lastOffset[0], Math.max(lastOffset[0], usageStart), originalAttrs, false, null, result);

        UsageType usageType = isHighlightedAsString(tokenHighlights)
                         ? UsageType.LITERAL_USAGE
                         : isHighlightedAsComment(tokenHighlights) ? UsageType.COMMENT_USAGE : null;
        addChunk(chars, Math.max(lastOffset[0], usageStart), Math.min(hiEnd, usageEnd), originalAttrs, selectUsageWithBold, usageType, result);
        lastOffset[0] = usageEnd;
        if (usageEnd > hiEnd) {
          return false;
        }
      }
      return true;
    }
  });
  if (lastOffset[0] < hiEnd) {
    addChunk(chars, lastOffset[0], hiEnd, originalAttrs, false, null, result);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:38,代碼來源:ChunkExtractor.java

示例2: setInheritedAttributes

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private void setInheritedAttributes(@NotNull TextAttributes attributes) {
  attributes.setFontType(myFallbackAttributes.getFontType());
  attributes.setForegroundColor(myFallbackAttributes.getForegroundColor());
  attributes.setBackgroundColor(myFallbackAttributes.getBackgroundColor());
  attributes.setErrorStripeColor(myFallbackAttributes.getErrorStripeColor());
  attributes.setEffectColor(myFallbackAttributes.getEffectColor());
  attributes.setEffectType(myFallbackAttributes.getEffectType());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:ColorAndFontOptions.java

示例3: createCompilationErrorAttr

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private static TextAttributes createCompilationErrorAttr() {
  TextAttributes attr = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.HYPERLINK_ATTRIBUTES).clone();
  attr.setForegroundColor(JBColor.RED);
  attr.setEffectColor(JBColor.RED);
  attr.setEffectType(EffectType.LINE_UNDERSCORE);
  attr.setFontType(Font.PLAIN);
  return attr;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:AbstractMavenConsoleFilter.java

示例4: apply

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
@Override
public void apply(@NotNull TextAttributes ta) {
    int fontType = Font.PLAIN;
    if (myCbBold.isSelected()) {
        fontType |= Font.BOLD;
    }
    if (myCbItalic.isSelected()) {
        fontType |= Font.ITALIC;
    }

    ta.setFontType(fontType);

    if (myCbForeground.isSelected()) {
        ta.setForegroundColor(myForegroundChooser.getSelectedColor());
    } else {
        ta.setForegroundColor(null);
    }

    if (myCbBackground.isSelected()) {
        ta.setBackgroundColor(myBackgroundChooser.getSelectedColor());
    } else {
        ta.setBackgroundColor(null);
    }

    if (myCbErrorStripe.isSelected()) {
        ta.setErrorStripeColor(myErrorStripeColorChooser.getSelectedColor());
    } else {
        ta.setErrorStripeColor(null);
    }

    if (myCbEffects.isSelected()) {
        Color effectColor = myEffectsColorChooser.getSelectedColor();
        ta.setEffectColor(effectColor);
        //noinspection SuspiciousMethodCalls
        if (effectColor == null) {
            ta.setEffectType(null);
        } else {
            //noinspection SuspiciousMethodCalls
            ta.setEffectType(myEffectsMap.get(myEffectsCombo.getModel().getSelectedItem()));
        }
    } else {
        ta.setEffectColor(null);
        ta.setEffectType(null);
    }
}
 
開發者ID:huoguangjin,項目名稱:MultiHighlight,代碼行數:46,代碼來源:ColorChooserPanel.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: getTextAttributes

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private SimpleTextAttributes getTextAttributes(final int row, final Property property) {
  // 1. Text
  ErrorInfo errInfo = getErrorInfoForRow(row);

  SimpleTextAttributes result;
  boolean modified;
  try {
    modified = isModifiedForSelection(property);
  }
  catch(Exception ex) {
    // ignore exceptions here - they'll be reported as red property values
    modified = false;
  }
  if (errInfo == null) {
    result = modified ? SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES;
  }
  else {
    final HighlightSeverity severity = errInfo.getHighlightDisplayLevel().getSeverity();
    Map<HighlightSeverity, SimpleTextAttributes> cache = modified ? myModifiedHighlightAttributes : myHighlightAttributes;
    result = cache.get(severity);
    if (result == null) {
      final TextAttributesKey attrKey = SeverityRegistrar.getSeverityRegistrar(myProject).getHighlightInfoTypeBySeverity(severity).getAttributesKey();
      TextAttributes textAttrs = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(attrKey);
      if (modified) {
        textAttrs = textAttrs.clone();
        textAttrs.setFontType(textAttrs.getFontType() | Font.BOLD);
      }
      result = SimpleTextAttributes.fromTextAttributes(textAttrs);
      cache.put(severity, result);
    }
  }

  if (property instanceof IntrospectedProperty) {
    final RadComponent c = mySelection.get(0);
    if (Properties.getInstance().isPropertyDeprecated(c.getModule(), c.getComponentClass(), property.getName())) {
      return new SimpleTextAttributes(result.getBgColor(), result.getFgColor(), result.getWaveColor(),
                                      result.getStyle() | SimpleTextAttributes.STYLE_STRIKEOUT);
    }
  }

  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:43,代碼來源:PropertyInspectorTable.java


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