diff --git a/code/src/vs/workbench/contrib/terminal/browser/che/terminalMenus.ts b/code/src/vs/workbench/contrib/terminal/browser/che/terminalMenus.ts new file mode 100644 index 00000000000..90074402a6f --- /dev/null +++ b/code/src/vs/workbench/contrib/terminal/browser/che/terminalMenus.ts @@ -0,0 +1,52 @@ +/********************************************************************** + * Copyright (c) 2023 Red Hat, Inc. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + ***********************************************************************/ +/* eslint-disable header/header */ + +import { localize } from 'vs/nls'; +import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions'; +import { TerminalMenuBarGroup } from 'vs/workbench/contrib/terminal/browser/terminalMenus'; + +// see enum ContextMenuGroup in the terminalMenus +const CONTEXT_MENU_GROUP_CREATE = '1_create'; +const NEW_TERMINAL_IN_CONTAINER_COMMAND_ID = 'che-terminal.new'; +const NEW_TERMINAL_IN_CONTAINER_TITLE = localize('newTerminal.selectContainer.title', 'New Terminal (Select a Container)'); + +export function setupCheTerminalMenus(): void { + MenuRegistry.appendMenuItems( + [ + { + id: MenuId.MenubarTerminalMenu, + item: { + group: TerminalMenuBarGroup.Create, + command: { + id: NEW_TERMINAL_IN_CONTAINER_COMMAND_ID, + title: NEW_TERMINAL_IN_CONTAINER_TITLE + }, + order: 1.5 + } + } + ] + ); + + MenuRegistry.appendMenuItems( + [ + { + id: MenuId.TerminalInstanceContext, + item: { + command: { + id: NEW_TERMINAL_IN_CONTAINER_COMMAND_ID, + title: NEW_TERMINAL_IN_CONTAINER_TITLE + }, + group: CONTEXT_MENU_GROUP_CREATE + } + } + ] + ); +} diff --git a/code/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts b/code/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts index be211a84308..0a04de4f8a7 100644 --- a/code/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts +++ b/code/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts @@ -52,6 +52,7 @@ import { RemoteTerminalBackendContribution } from 'vs/workbench/contrib/terminal import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'; import { TerminalMainContribution } from 'vs/workbench/contrib/terminal/browser/terminalMainContribution'; import { Schemas } from 'vs/base/common/network'; +import { setupCheTerminalMenus } from 'vs/workbench/contrib/terminal/browser/che/terminalMenus'; // Register services registerSingleton(ITerminalService, TerminalService, InstantiationType.Delayed); @@ -282,5 +283,6 @@ registerSendSequenceKeybinding('\u001f', { setupTerminalCommands(); setupTerminalMenus(); +setupCheTerminalMenus(); registerColors();