本文整理汇总了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];
}
示例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);
}
}