diff --git a/src/vs/code/electron-main/menus.ts b/src/vs/code/electron-main/menus.ts index c3566e003ba5c95d3927dbac44c0afc83bfd369b..68c626fc16780b8fc03c8dd010a68d3c2ae7dc0c 100644 --- a/src/vs/code/electron-main/menus.ts +++ b/src/vs/code/electron-main/menus.ts @@ -644,7 +644,7 @@ export class VSCodeMenu { arrays.coalesce([ this.envService.product.documentationUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miDocumentation', comment: ['&& denotes a mnemonic'] }, "&&Documentation")), click: () => this.openUrl(this.envService.product.documentationUrl, 'openDocumentationUrl') }) : null, - this.envService.product.releaseNotesUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miReleaseNotes', comment: ['&& denotes a mnemonic'] }, "&&Release Notes")), click: () => this.openUrl(this.envService.product.releaseNotesUrl, 'openReleaseNotesUrl') }) : null, + this.envService.product.releaseNotesUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miReleaseNotes', comment: ['&& denotes a mnemonic'] }, "&&Release Notes")), click: () => this.windowsService.sendToFocused('vscode:runAction', 'update.showCurrentReleaseNotes') }) : null, (this.envService.product.documentationUrl || this.envService.product.releaseNotesUrl) ? __separator__() : null, this.envService.product.twitterUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miTwitter', comment: ['&& denotes a mnemonic'] }, "&&Join us on Twitter")), click: () => this.openUrl(this.envService.product.twitterUrl, 'openTwitterUrl') }) : null, this.envService.product.requestFeatureUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miUserVoice', comment: ['&& denotes a mnemonic'] }, "&&Search Feature Requests")), click: () => this.openUrl(this.envService.product.requestFeatureUrl, 'openUserVoiceUrl') }) : null, diff --git a/src/vs/workbench/electron-browser/update.ts b/src/vs/workbench/electron-browser/update.ts index f9795938ba6b31e2b438d66e2ad3e514e7e0454e..23c323ef0a7cca20666e7c352698e4cbcace1f62 100644 --- a/src/vs/workbench/electron-browser/update.ts +++ b/src/vs/workbench/electron-browser/update.ts @@ -11,6 +11,7 @@ import {TPromise} from 'vs/base/common/winjs.base'; import {Action} from 'vs/base/common/actions'; import {ipcRenderer as ipc, shell} from 'electron'; import {IMessageService} from 'vs/platform/message/common/message'; +import pkg from 'vs/platform/package'; import product from 'vs/platform/product'; import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; @@ -38,15 +39,17 @@ const NotNowAction = new Action( () => TPromise.as(true) ); -export class ShowReleaseNotesAction extends Action { +export abstract class AbstractShowReleaseNotesAction extends Action { constructor( + id, + label, private returnValue: boolean, private version: string, @IWorkbenchEditorService private editorService: IWorkbenchEditorService, @IInstantiationService private instantiationService: IInstantiationService ) { - super('update.showReleaseNotes', nls.localize('releaseNotes', "Release Notes"), null, true); + super(id, label, null, true); } run(): TPromise { @@ -55,6 +58,33 @@ export class ShowReleaseNotesAction extends Action { } } +export class ShowReleaseNotesAction extends AbstractShowReleaseNotesAction { + + constructor( + returnValue: boolean, + version: string, + @IWorkbenchEditorService editorService: IWorkbenchEditorService, + @IInstantiationService instantiationService: IInstantiationService + ) { + super('update.showReleaseNotes', nls.localize('releaseNotes', "Release Notes"), returnValue, version, editorService, instantiationService); + } +} + +export class ShowCurrentReleaseNotesAction extends AbstractShowReleaseNotesAction { + + static ID = 'update.showCurrentReleaseNotes'; + static LABEL = nls.localize('showReleaseNotes', "Show Release Notes"); + + constructor( + id = ShowCurrentReleaseNotesAction.ID, + label = ShowCurrentReleaseNotesAction.LABEL, + @IWorkbenchEditorService editorService: IWorkbenchEditorService, + @IInstantiationService instantiationService: IInstantiationService + ) { + super(id, label, true, pkg.version, editorService, instantiationService); + } +} + export const DownloadAction = (url: string) => new Action( 'update.download', nls.localize('downloadNow', "Download Now"), diff --git a/src/vs/workbench/parts/update/electron-browser/update.contribution.ts b/src/vs/workbench/parts/update/electron-browser/update.contribution.ts index 2c2c2dc267a9afe85cf1e6474ba5688ff381ac8b..a31d45117abca9323d5f59cfd15bee23d2b85dc0 100644 --- a/src/vs/workbench/parts/update/electron-browser/update.contribution.ts +++ b/src/vs/workbench/parts/update/electron-browser/update.contribution.ts @@ -15,7 +15,7 @@ import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } f import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { IMessageService } from 'vs/platform/message/common/message'; import Severity from 'vs/base/common/severity'; -import { ShowReleaseNotesAction } from 'vs/workbench/electron-browser/update'; +import { ShowReleaseNotesAction, ShowCurrentReleaseNotesAction } from 'vs/workbench/electron-browser/update'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { Action } from 'vs/base/common/actions'; import { shell } from 'electron'; @@ -25,6 +25,8 @@ import * as semver from 'semver'; import { EditorDescriptor } from 'vs/workbench/browser/parts/editor/baseEditor'; import { IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/common/editor'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; +import {IWorkbenchActionRegistry, Extensions as ActionExtensions} from 'vs/workbench/common/actionRegistry'; +import {SyncActionDescriptor} from 'vs/platform/actions/common/actions'; const CloseAction = new Action('close', nls.localize('close', "Close"), '', true, () => null); @@ -113,4 +115,7 @@ const editorDescriptor = new EditorDescriptor( ); Registry.as(EditorExtensions.Editors) - .registerEditor(editorDescriptor, [new SyncDescriptor(ReleaseNotesInput)]); \ No newline at end of file + .registerEditor(editorDescriptor, [new SyncDescriptor(ReleaseNotesInput)]); + +Registry.as(ActionExtensions.WorkbenchActions) + .registerWorkbenchAction(new SyncActionDescriptor(ShowCurrentReleaseNotesAction, ShowCurrentReleaseNotesAction.ID, ShowCurrentReleaseNotesAction.LABEL), 'Open Release Notes'); \ No newline at end of file