void (@NotNull BuildEvent event, @NotNull Project project, @NotNull SMTestProxy.SMRootTestProxy testsRootNode) { // open Build tw for file error, as it usually comes from compilation if ((event instanceof FileMessageEvent) && ((FileMessageEvent)event).getKind() == MessageEvent.Kind.ERROR) { openBuildToolWindow(project); return; } // open Build tw for recognized build failures like startup errors if (event instanceof FinishBuildEvent) { EventResult buildResult = ((FinishBuildEvent)event).getResult(); if (buildResult instanceof FailureResult) { if (!((FailureResult)buildResult).getFailures().isEmpty()) { openBuildToolWindow(project); } else { ApplicationManager.getApplication().invokeLater(() -> { if (!testsRootNode.isInProgress() && testsRootNode.isEmptySuite()) { openBuildToolWindow(project); } }); } } } }