private void scheduleOpenSessionInDirectory(@NotNull TerminalWidget terminalWidget,
                                              @NotNull ShellStartupOptions startupOptions,
                                              boolean deferSessionStartUntilUiShown) {
    if (deferSessionStartUntilUiShown) {
      UiNotifyConnector.doWhenFirstShown(terminalWidget.getComponent(), () -> openSessionInDirectory(terminalWidget, startupOptions));
    }
    else {
      openSessionInDirectory(terminalWidget, startupOptions);
    }
  }
private void scheduleOpenSessionInDirectory(@NotNull TerminalWidget terminalWidget,
                                              @NotNull ShellStartupOptions startupOptions,
                                              boolean deferSessionStartUntilUiShown)