void (@NotNull Project project, @NotNull String command, @NotNull String workingDirectory, @NotNull @NlsContexts.TabTitle String title, boolean activateToolWindow) { TerminalToolWindowManager terminalToolWindowManager = TerminalToolWindowManager.getInstance(project); ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(TerminalToolWindowFactory.TOOL_WINDOW_ID); if (window == null) { return; } ContentManager contentManager = window.getContentManager(); Pair<Content, TerminalWidget> pair = getSuitableProcess(contentManager, workingDirectory); if (pair == null) { terminalToolWindowManager.createShellWidget(workingDirectory, title, activateToolWindow, activateToolWindow) .sendCommandToExecute(command); return; } if (activateToolWindow) { window.activate(null); } pair.first.setDisplayName(title); contentManager.setSelectedContent(pair.first); pair.second.sendCommandToExecute(command); }