AntBuildMessageView (Project project, AntBuildFileBase buildFile, List<String> targets, List<BuildFileProperty> additionalProperties) { final VirtualFile antFile = buildFile.getVirtualFile(); if (!LOG.assertTrue(antFile != null)) { return null; } // check if there are running instances of the same build file MessageView ijMessageView = MessageView.getInstance(project); Content[] contents = ijMessageView.getContentManager().getContents(); for (Content content : contents) { if (content.isPinned()) { continue; } AntBuildMessageView buildMessageView = content.getUserData(KEY); if (buildMessageView == null) { continue; } if (!antFile.equals(buildMessageView.getBuildFile().getVirtualFile())) { continue; } if (buildMessageView.isStopped()) { ijMessageView.getContentManager().removeContent(content, true); continue; } int result = Messages.showYesNoCancelDialog(AntBundle.message("ant.is.active.terminate.confirmation.text"), AntBundle.message("starting.ant.build.dialog.title"), Messages.getQuestionIcon()); switch (result) { case Messages.YES -> { // yes buildMessageView.stopProcess(); ijMessageView.getContentManager().removeContent(content, true); } case Messages.NO -> { // no } default -> { // cancel return null; } } } final AntBuildMessageView messageView = new AntBuildMessageView(project, buildFile, targets, additionalProperties); String contentName = buildFile.getPresentableName(); contentName = getBuildContentName() + " (" + contentName + ")"; final Content content = ContentFactory.getInstance().createContent(messageView.getComponent(), contentName, true); content.putUserData(KEY, messageView); ijMessageView.getContentManager().addContent(content); ijMessageView.getContentManager().setSelectedContent(content); content.setDisposer(() -> Disposer.dispose(messageView)); new CloseListener(content, ijMessageView.getContentManager(), project).setupListeners(); if (!buildFile.isRunInBackground()) { final ToolWindow tw = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.MESSAGES_WINDOW); if (tw != null) { tw.activate(null, false); } } return messageView; }