Content (@Nullable TerminalWidget terminalWidget, @NotNull AbstractTerminalRunner<?> terminalRunner, @NotNull ToolWindow toolWindow, @Nullable TerminalTabState tabState, boolean requestFocus, boolean deferSessionStartUntilUiShown) { final Content content = createTerminalContent(terminalRunner, toolWindow, terminalWidget, tabState, deferSessionStartUntilUiShown); content.putUserData(RUNNER_KEY, terminalRunner); final ContentManager contentManager = toolWindow.getContentManager(); contentManager.addContent(content); new TerminalTabCloseListener(content, myProject, this); Runnable selectRunnable = () -> { contentManager.setSelectedContent(content, requestFocus); }; if (requestFocus && !toolWindow.isActive()) { if (LOG.isDebugEnabled()) { LOG.debug("Activating " + toolWindow.getId() + " tool window"); } toolWindow.activate(selectRunnable, true, true); } else { selectRunnable.run(); } return content; }