void (ProgressIndicator indicator) { if (!(indicator instanceof ProgressIndicatorEx)) { return; } ((ProgressIndicatorEx)indicator).addStateDelegate(new CompilerMessagesService.DummyProgressIndicator() { private final Map<String, Set<String>> mySeenMessages = new HashMap<>(); @NlsSafe private String lastMessage = null; private Stack<@NlsContexts.ProgressText String> myTextStack; @Override public void setText(@Nls(capitalization = Nls.Capitalization.Sentence) String text) { addIndicatorNewMessagesAsBuildOutput(text); } @Override public void pushState() { getTextStack().push(indicator.getText()); } @Override public void setFraction(double fraction) { myBuildProgress.progress(lastMessage, 100, (long)(fraction * 100), "%"); } @NotNull private Stack<@NlsContexts.ProgressText String> getTextStack() { Stack<@NlsContexts.ProgressText String> stack = myTextStack; if (stack == null) myTextStack = stack = new Stack<>(2); return stack; } private void addIndicatorNewMessagesAsBuildOutput(@Nls String msg) { Stack<@NlsContexts.ProgressText String> textStack = getTextStack(); if (!textStack.isEmpty() && msg.equals(textStack.peek())) { textStack.pop(); return; } if (isEmptyOrSpaces(msg) || msg.equals(lastMessage)) return; lastMessage = msg; int start = msg.indexOf("["); if (start >= 1) { int end = msg.indexOf(']', start + 1); if (end != -1) { String buildTargetNameCandidate = msg.substring(start + 1, end); Set<String> targets = mySeenMessages.computeIfAbsent(buildTargetNameCandidate, unused -> new HashSet<>()); boolean isSeenMessage = !targets.add(msg.substring(0, start)); if (isSeenMessage) return; } } myConsolePrinter.print(msg, MessageEvent.Kind.SIMPLE); } }); }