提交 a51aa786 编写于 作者: J Joao Moreno

fixes #12943

上级 15c4cbf9
......@@ -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,
......
......@@ -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<boolean> {
......@@ -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"),
......
......@@ -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<IEditorRegistry>(EditorExtensions.Editors)
.registerEditor(editorDescriptor, [new SyncDescriptor(ReleaseNotesInput)]);
\ No newline at end of file
.registerEditor(editorDescriptor, [new SyncDescriptor(ReleaseNotesInput)]);
Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions)
.registerWorkbenchAction(new SyncActionDescriptor(ShowCurrentReleaseNotesAction, ShowCurrentReleaseNotesAction.ID, ShowCurrentReleaseNotesAction.LABEL), 'Open Release Notes');
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册