当前位置: 首页>>代码示例>>Java>>正文


Java ConsoleViewContentType.NORMAL_OUTPUT_KEY属性代码示例

本文整理汇总了Java中com.intellij.execution.ui.ConsoleViewContentType.NORMAL_OUTPUT_KEY属性的典型用法代码示例。如果您正苦于以下问题:Java ConsoleViewContentType.NORMAL_OUTPUT_KEY属性的具体用法?Java ConsoleViewContentType.NORMAL_OUTPUT_KEY怎么用?Java ConsoleViewContentType.NORMAL_OUTPUT_KEY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.execution.ui.ConsoleViewContentType的用法示例。


在下文中一共展示了ConsoleViewContentType.NORMAL_OUTPUT_KEY属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAnsiColorKey

public static TextAttributesKey getAnsiColorKey(int value) {
  if (value >= 16) {
    return ConsoleViewContentType.NORMAL_OUTPUT_KEY;
  }
  return myAnsiColorKeys[value];
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ColoredOutputTypeRegistry.java

示例2: doPrintNotification

void doPrintNotification(final Notification notification) {
  Editor editor = myLogEditor.getValue();
  if (editor.isDisposed()) {
    return;
  }

  Document document = editor.getDocument();
  boolean scroll = document.getTextLength() == editor.getCaretModel().getOffset() || !editor.getContentComponent().hasFocus();

  String date = DateFormatUtil.formatTimeWithSeconds(notification.getTimestamp()) + " ";
  append(document, date);

  int startLine = document.getLineCount() - 1;

  EventLog.LogEntry pair = EventLog.formatForLog(notification, StringUtil.repeatSymbol(' ', date.length()));

  final NotificationType type = notification.getType();
  TextAttributesKey key = type == NotificationType.ERROR
                                       ? ConsoleViewContentType.LOG_ERROR_OUTPUT_KEY
                                       : type == NotificationType.INFORMATION
                                         ? ConsoleViewContentType.NORMAL_OUTPUT_KEY
                                         : ConsoleViewContentType.LOG_WARNING_OUTPUT_KEY;

  int msgStart = document.getTextLength();
  String message = pair.message;
  append(document, message);

  TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(key);
  int layer = HighlighterLayer.CARET_ROW + 1;
  editor.getMarkupModel().addRangeHighlighter(msgStart, document.getTextLength(), layer, attributes, HighlighterTargetArea.EXACT_RANGE);

  for (Pair<TextRange, HyperlinkInfo> link : pair.links) {
    final RangeHighlighter rangeHighlighter = myHyperlinkSupport.getValue()
      .createHyperlink(link.first.getStartOffset() + msgStart, link.first.getEndOffset() + msgStart, null, link.second);
    if (link.second instanceof EventLog.ShowBalloon) {
      ((EventLog.ShowBalloon)link.second).setRangeHighlighter(rangeHighlighter);
    }
  }

  append(document, "\n");

  if (scroll) {
    editor.getCaretModel().moveToOffset(document.getTextLength());
    editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
  }

  if (notification.isImportant()) {
    highlightNotification(notification, pair.status, startLine, document.getLineCount() - 1);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:50,代码来源:EventLogConsole.java


注:本文中的com.intellij.execution.ui.ConsoleViewContentType.NORMAL_OUTPUT_KEY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。