TerminalWidget (@NotNull Disposable parent, @NotNull ShellStartupOptions startupOptions, boolean deferSessionStartUntilUiShown) { try { myStartupOptionsThreadLocal.set(startupOptions); return createTerminalWidget(parent, startupOptions.getWorkingDirectory(), deferSessionStartUntilUiShown).asNewWidget(); } catch (IncompatibleWidgetException e) { TerminalWidget widget = createShellTerminalWidget(parent, startupOptions); scheduleOpenSessionInDirectory(widget, startupOptions, deferSessionStartUntilUiShown); return widget; } finally { myStartupOptionsThreadLocal.remove(); } }