ProcessOutputType (@NotNull AnsiTerminalEmulator terminal, @NotNull Key streamType) { Map<String, ProcessOutputType> attrsToKeyMap = ProcessOutputType.isStdout(streamType) ? myStdoutAttrsToKeyMap : myStderrAttrsToKeyMap; String ansiSerializedState = terminal.getAnsiSerializedSGRState(); ProcessOutputType key = attrsToKeyMap.get(ansiSerializedState); if (key != null) { return key; } ProcessOutputType streamOutputType = streamType instanceof ProcessOutputType ? (ProcessOutputType)streamType : (ProcessOutputType)ProcessOutputTypes.STDOUT; ProcessOutputType newKey = new ProcessOutputType(ansiSerializedState, streamOutputType); ConsoleViewContentType.registerNewConsoleViewType(newKey, createAnsiConsoleViewContentType(terminal)); attrsToKeyMap.put(ansiSerializedState, newKey); return newKey; }