Commit 7842a54d authored by Sergey Simonchik's avatar Sergey Simonchik
Browse files

make NORMAL_OUTPUT default; NotNull

parent 6a32004d
Showing with 11 additions and 5 deletions
+11 -5
......@@ -21,11 +21,11 @@ import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.util.Key;
import java.util.HashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
......@@ -101,8 +101,9 @@ public class ConsoleViewContentType {
ourRegisteredTypes.put(processOutputType, attributes);
}
public static synchronized ConsoleViewContentType getConsoleViewType(final Key processOutputType) {
return ourRegisteredTypes.getOrDefault(processOutputType, SYSTEM_OUTPUT);
@NotNull
public static synchronized ConsoleViewContentType getConsoleViewType(@NotNull Key processOutputType) {
return ourRegisteredTypes.getOrDefault(processOutputType, NORMAL_OUTPUT);
}
public static synchronized Collection<ConsoleViewContentType> getRegisteredTypes() {
......
......@@ -15,6 +15,7 @@
*/
package com.intellij.execution.impl;
import com.intellij.execution.process.ProcessOutputTypes;
import com.intellij.execution.ui.ConsoleView;
import com.intellij.execution.ui.ConsoleViewContentType;
import com.intellij.ide.ui.LafManager;
......@@ -36,6 +37,7 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.ObjectUtils;
import com.intellij.util.containers.ConcurrentFactoryMap;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.text.StringTokenizer;
......@@ -236,8 +238,11 @@ public class ConsoleViewUtil {
@NotNull
public static ConsoleViewContentType getContentTypeForToken(@NotNull IElementType tokenType, @NotNull SyntaxHighlighter highlighter) {
TextAttributesKey[] keys = highlighter.getTokenHighlights(tokenType);
return keys.length == 0 ? ConsoleViewContentType.NORMAL_OUTPUT :
ConsoleViewContentType.getConsoleViewType(ColorCache.keys.get(Arrays.asList(keys)));
if (keys.length == 0) {
return ConsoleViewContentType.NORMAL_OUTPUT;
}
Key key = ColorCache.keys.get(Arrays.asList(keys));
return ConsoleViewContentType.getConsoleViewType(ObjectUtils.notNull(key, ProcessOutputTypes.STDOUT));
}
public static void printAsFileType(@NotNull ConsoleView console, @NotNull String text, @NotNull FileType fileType) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment