diff --git a/src/vs/code/electron-main/menus.ts b/src/vs/code/electron-main/menus.ts index df488646937..759fbd3cc5f 100644 --- a/src/vs/code/electron-main/menus.ts +++ b/src/vs/code/electron-main/menus.ts @@ -632,7 +632,7 @@ export class VSCodeMenu { private setViewMenu(viewMenu: Electron.Menu): void { const explorer = this.createMenuItem(nls.localize({ key: 'miViewExplorer', comment: ['&& denotes a mnemonic'] }, "&&Explorer"), 'workbench.view.explorer'); const search = this.createMenuItem(nls.localize({ key: 'miViewSearch', comment: ['&& denotes a mnemonic'] }, "&&Search"), 'workbench.view.search'); - const git = this.createMenuItem(nls.localize({ key: 'miViewGit', comment: ['&& denotes a mnemonic'] }, "&&Git"), 'workbench.view.git'); + const scm = this.createMenuItem(nls.localize({ key: 'miViewSCM', comment: ['&& denotes a mnemonic'] }, "S&&CM"), 'workbench.view.scm'); const debug = this.createMenuItem(nls.localize({ key: 'miViewDebug', comment: ['&& denotes a mnemonic'] }, "&&Debug"), 'workbench.view.debug'); const extensions = this.createMenuItem(nls.localize({ key: 'miViewExtensions', comment: ['&& denotes a mnemonic'] }, "E&&xtensions"), 'workbench.view.extensions'); const output = this.createMenuItem(nls.localize({ key: 'miToggleOutput', comment: ['&& denotes a mnemonic'] }, "&&Output"), 'workbench.action.output.toggleOutput'); @@ -700,7 +700,7 @@ export class VSCodeMenu { __separator__(), explorer, search, - git, + scm, debug, extensions, additionalViewlets, diff --git a/src/vs/workbench/parts/scm/browser/scm.contribution.ts b/src/vs/workbench/parts/scm/browser/scm.contribution.ts index e7033a11fe4..3e13e45fc50 100644 --- a/src/vs/workbench/parts/scm/browser/scm.contribution.ts +++ b/src/vs/workbench/parts/scm/browser/scm.contribution.ts @@ -9,8 +9,13 @@ import { localize } from 'vs/nls'; import { Registry } from 'vs/platform/platform'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { DirtyDiffDecorator } from './dirtydiffDecorator'; -import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet'; +import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor, ToggleViewletAction } from 'vs/workbench/browser/viewlet'; import { VIEWLET_ID } from 'vs/workbench/parts/scm/common/scm'; +import { IWorkbenchActionRegistry, Extensions as WorkbenchActionExtensions } from 'vs/workbench/common/actionRegistry'; +import { KeyMod, KeyCode } from 'vs/base/common/keyCodes'; +import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; +import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; +import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; Registry.as(WorkbenchExtensions.Workbench) .registerWorkbenchContribution(DirtyDiffDecorator); @@ -25,4 +30,25 @@ const viewletDescriptor = new ViewletDescriptor( ); Registry.as(ViewletExtensions.Viewlets) - .registerViewlet(viewletDescriptor); \ No newline at end of file + .registerViewlet(viewletDescriptor); + +class OpenSCMViewletAction extends ToggleViewletAction { + public static ID = VIEWLET_ID; + public static LABEL = localize('toggleGitViewlet', "Show Git"); + + constructor(id: string, label: string, @IViewletService viewletService: IViewletService, @IWorkbenchEditorService editorService: IWorkbenchEditorService) { + super(id, label, VIEWLET_ID, viewletService, editorService); + } +} + +// Register Action to Open Viewlet +Registry.as(WorkbenchActionExtensions.WorkbenchActions).registerWorkbenchAction( + new SyncActionDescriptor(OpenSCMViewletAction, VIEWLET_ID, localize('toggleSCMViewlet', "Show SCM"), { + primary: null, + win: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_G }, + linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_G }, + mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KEY_G } + }), + 'View: Show SCM', + localize('view', "View") +); \ No newline at end of file