当前位置: 首页>>代码示例>>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;未经允许,请勿转载。