OutputEventSplitter (final boolean bufferTextUntilNewLine, final boolean cutNewLineBeforeServiceMessage) { return new OutputEventSplitter(bufferTextUntilNewLine, cutNewLineBeforeServiceMessage) { @Override public void onTextAvailable(@NotNull final String text, @NotNull final Key<?> outputType) { final ProcessOutputType baseOutputType = ((ProcessOutputType)outputType).getBaseOutputType(); synchronized (myOutput) { final Console console = myOutput.computeIfAbsent(baseOutputType, key -> new Console()); console.processText(text, outputType); } } }; }