mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
a distinctive log console error color
This commit is contained in:
+9
-3
@@ -27,7 +27,9 @@ public class ANSIColoredConsoleColorsPage implements ColorSettingsPage {
|
||||
"-<stdout> C:></stdout>\n" +
|
||||
"-<stdin> help</stdin>\n" +
|
||||
"<stderr>Bad command or file name</stderr>\n" +
|
||||
"<warning>Log warning</warning>\n" +
|
||||
"\n" +
|
||||
"<logError>Log error</logError>\n" +
|
||||
"<logWarning>Log warning</logWarning>\n" +
|
||||
"\n" +
|
||||
"# Process output highlighted using ANSI colors codes\n" +
|
||||
"<red>ANSI: red</red>\n" +
|
||||
@@ -42,10 +44,13 @@ public class ANSIColoredConsoleColorsPage implements ColorSettingsPage {
|
||||
|
||||
private static final AttributesDescriptor[] ATTRS = new AttributesDescriptor[]{
|
||||
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.console.stdout"), ConsoleViewContentType.NORMAL_OUTPUT_KEY),
|
||||
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.console.warning"), ConsoleViewContentType.WARNING_OUTPUT_KEY),
|
||||
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.console.stderr"), ConsoleViewContentType.ERROR_OUTPUT_KEY),
|
||||
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.console.stdin"), ConsoleViewContentType.USER_INPUT_KEY),
|
||||
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.console.system.output"), ConsoleViewContentType.SYSTEM_OUTPUT_KEY),
|
||||
|
||||
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.console.logError"), ConsoleViewContentType.LOG_ERROR_OUTPUT_KEY),
|
||||
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.console.warning"), ConsoleViewContentType.LOG_WARNING_OUTPUT_KEY),
|
||||
|
||||
new AttributesDescriptor(OptionsBundle.message("color.settings.console.red"), ConsoleHighlighter.RED),
|
||||
new AttributesDescriptor(OptionsBundle.message("color.settings.console.green"), ConsoleHighlighter.GREEN),
|
||||
new AttributesDescriptor(OptionsBundle.message("color.settings.console.yellow"), ConsoleHighlighter.YELLOW),
|
||||
@@ -61,7 +66,8 @@ public class ANSIColoredConsoleColorsPage implements ColorSettingsPage {
|
||||
ADDITIONAL_HIGHLIGHT_DESCRIPTORS.put("stdout", ConsoleViewContentType.NORMAL_OUTPUT_KEY);
|
||||
ADDITIONAL_HIGHLIGHT_DESCRIPTORS.put("stdin", ConsoleViewContentType.USER_INPUT_KEY);
|
||||
ADDITIONAL_HIGHLIGHT_DESCRIPTORS.put("stderr", ConsoleViewContentType.ERROR_OUTPUT_KEY);
|
||||
ADDITIONAL_HIGHLIGHT_DESCRIPTORS.put("warning", ConsoleViewContentType.WARNING_OUTPUT_KEY);
|
||||
ADDITIONAL_HIGHLIGHT_DESCRIPTORS.put("logError", ConsoleViewContentType.LOG_WARNING_OUTPUT_KEY);
|
||||
ADDITIONAL_HIGHLIGHT_DESCRIPTORS.put("logWarning", ConsoleViewContentType.LOG_ERROR_OUTPUT_KEY);
|
||||
|
||||
ADDITIONAL_HIGHLIGHT_DESCRIPTORS.put("red", ConsoleHighlighter.RED);
|
||||
ADDITIONAL_HIGHLIGHT_DESCRIPTORS.put("green", ConsoleHighlighter.GREEN);
|
||||
|
||||
@@ -39,13 +39,13 @@ public class ConsoleViewContentType {
|
||||
public static final ColorKey CONSOLE_BACKGROUND_KEY = ColorKey.createColorKey("CONSOLE_BACKGROUND_KEY");
|
||||
|
||||
public static final TextAttributesKey NORMAL_OUTPUT_KEY = TextAttributesKey.createTextAttributesKey("CONSOLE_NORMAL_OUTPUT");
|
||||
public static final TextAttributesKey WARNING_OUTPUT_KEY = TextAttributesKey.createTextAttributesKey("CONSOLE_WARNING_OUTPUT");
|
||||
public static final TextAttributesKey LOG_WARNING_OUTPUT_KEY = TextAttributesKey.createTextAttributesKey("LOG_WARNING_OUTPUT");
|
||||
public static final TextAttributesKey ERROR_OUTPUT_KEY = TextAttributesKey.createTextAttributesKey("CONSOLE_ERROR_OUTPUT");
|
||||
public static final TextAttributesKey LOG_ERROR_OUTPUT_KEY = TextAttributesKey.createTextAttributesKey("LOG_ERROR_OUTPUT");
|
||||
public static final TextAttributesKey USER_INPUT_KEY = TextAttributesKey.createTextAttributesKey("CONSOLE_USER_INPUT");
|
||||
public static final TextAttributesKey SYSTEM_OUTPUT_KEY = TextAttributesKey.createTextAttributesKey("CONSOLE_SYSTEM_OUTPUT");
|
||||
|
||||
public static final ConsoleViewContentType NORMAL_OUTPUT = new ConsoleViewContentType("NORMAL_OUTPUT", NORMAL_OUTPUT_KEY);
|
||||
public static final ConsoleViewContentType WARNING_OUTPUT = new ConsoleViewContentType("ERROR_OUTPUT", WARNING_OUTPUT_KEY);
|
||||
public static final ConsoleViewContentType ERROR_OUTPUT = new ConsoleViewContentType("ERROR_OUTPUT", ERROR_OUTPUT_KEY);
|
||||
public static final ConsoleViewContentType USER_INPUT = new ConsoleViewContentType("USER_OUTPUT", USER_INPUT_KEY);
|
||||
public static final ConsoleViewContentType SYSTEM_OUTPUT = new ConsoleViewContentType("SYSTEM_OUTPUT", SYSTEM_OUTPUT_KEY);
|
||||
|
||||
@@ -26,6 +26,8 @@ import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.ScrollType;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.editor.event.EditorMouseEvent;
|
||||
import com.intellij.openapi.editor.ex.EditorMarkupModel;
|
||||
import com.intellij.openapi.editor.markup.*;
|
||||
@@ -113,18 +115,19 @@ class EventLogConsole {
|
||||
Pair<String, Boolean> pair = EventLog.formatForLog(notification);
|
||||
|
||||
final NotificationType type = notification.getType();
|
||||
ConsoleViewContentType contentType = type == NotificationType.ERROR
|
||||
? ConsoleViewContentType.ERROR_OUTPUT
|
||||
TextAttributesKey key = type == NotificationType.ERROR
|
||||
? ConsoleViewContentType.LOG_ERROR_OUTPUT_KEY
|
||||
: type == NotificationType.INFORMATION
|
||||
? ConsoleViewContentType.NORMAL_OUTPUT
|
||||
: ConsoleViewContentType.WARNING_OUTPUT;
|
||||
? ConsoleViewContentType.NORMAL_OUTPUT_KEY
|
||||
: ConsoleViewContentType.LOG_WARNING_OUTPUT_KEY;
|
||||
|
||||
int msgStart = document.getTextLength();
|
||||
String message = pair.first;
|
||||
append(document, message);
|
||||
myLogEditor.getMarkupModel()
|
||||
.addRangeHighlighter(msgStart, document.getTextLength(), HighlighterLayer.CARET_ROW + 1, contentType.getAttributes(),
|
||||
HighlighterTargetArea.EXACT_RANGE);
|
||||
|
||||
TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(key);
|
||||
int layer = HighlighterLayer.CARET_ROW + 1;
|
||||
myLogEditor.getMarkupModel().addRangeHighlighter(msgStart, document.getTextLength(), layer, attributes, HighlighterTargetArea.EXACT_RANGE);
|
||||
|
||||
if (pair.second) {
|
||||
String s = " ";
|
||||
|
||||
@@ -127,7 +127,8 @@ options.general.color.descriptor.modified.lines=Modified lines
|
||||
options.general.color.descriptor.console.background=Console background
|
||||
options.general.color.descriptor.console.stdout=Console standard output
|
||||
options.general.color.descriptor.console.stderr=Console error output
|
||||
options.general.color.descriptor.console.warning=Console warning output
|
||||
options.general.color.descriptor.console.warning=Log console warning
|
||||
options.general.color.descriptor.console.logError=Log console error
|
||||
options.general.color.descriptor.console.stdin=Console user input
|
||||
options.general.color.descriptor.console.system.output=Console system output
|
||||
options.general.color.descriptor.hyperlink.new=Hyperlink
|
||||
|
||||
@@ -1139,11 +1139,16 @@
|
||||
<option name="FOREGROUND" value="7f0000"/>
|
||||
</value>
|
||||
</option>
|
||||
<option name="CONSOLE_WARNING_OUTPUT">
|
||||
<option name="LOG_WARNING_OUTPUT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="80A000"/>
|
||||
</value>
|
||||
</option>
|
||||
<option name="LOG_ERROR_OUTPUT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="ff0000"/>
|
||||
</value>
|
||||
</option>
|
||||
<option name="CONSOLE_USER_INPUT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="007f00"/>
|
||||
|
||||
Reference in New Issue
Block a user