From 791c8fba07c8f22e38e1d3cefd2a6913941edc94 Mon Sep 17 00:00:00 2001 From: Christof Marti Date: Fri, 20 Jan 2017 15:35:33 -0800 Subject: [PATCH] Add OpenIntroductoryVideosUrlAction (fixes #18862) --- src/vs/code/electron-main/menus.ts | 2 +- src/vs/workbench/electron-browser/actions.ts | 21 +++++++++++++++++++ .../electron-browser/main.contribution.ts | 5 ++++- .../electron-browser/welcomePage.html | 2 +- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/vs/code/electron-main/menus.ts b/src/vs/code/electron-main/menus.ts index 26d3d41dd13..218df383df7 100644 --- a/src/vs/code/electron-main/menus.ts +++ b/src/vs/code/electron-main/menus.ts @@ -851,7 +851,7 @@ export class VSCodeMenu { 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, enableWelcomePage || product.documentationUrl || product.releaseNotesUrl ? __separator__() : null, keyboardShortcutsUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miKeyboardShortcuts', comment: ['&& denotes a mnemonic'] }, "&&Keyboard Shortcuts Reference")), click: () => this.windowsService.sendToFocused('vscode:runAction', 'workbench.action.keybindingsReference') }) : null, - product.introductoryVideosUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miIntroductoryVideos', comment: ['&& denotes a mnemonic'] }, "Introductory &&Videos")), click: () => this.openUrl(product.introductoryVideosUrl, 'openIntroductoryVideosUrl') }) : null, + product.introductoryVideosUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miIntroductoryVideos', comment: ['&& denotes a mnemonic'] }, "Introductory &&Videos")), click: () => this.windowsService.sendToFocused('vscode:runAction', 'workbench.action.openIntroductoryVideosUrl') }) : null, (product.introductoryVideosUrl || keyboardShortcutsUrl) ? __separator__() : null, product.twitterUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miTwitter', comment: ['&& denotes a mnemonic'] }, "&&Join us on Twitter")), click: () => this.openUrl(product.twitterUrl, 'openTwitterUrl') }) : null, product.requestFeatureUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miUserVoice', comment: ['&& denotes a mnemonic'] }, "&&Search Feature Requests")), click: () => this.openUrl(product.requestFeatureUrl, 'openUserVoiceUrl') }) : null, diff --git a/src/vs/workbench/electron-browser/actions.ts b/src/vs/workbench/electron-browser/actions.ts index 568f7a5aae0..7415b45f4a0 100644 --- a/src/vs/workbench/electron-browser/actions.ts +++ b/src/vs/workbench/electron-browser/actions.ts @@ -877,6 +877,27 @@ export class OpenDocumentationUrlAction extends Action { } } +export class OpenIntroductoryVideosUrlAction extends Action { + + public static ID = 'workbench.action.openIntroductoryVideosUrl'; + public static LABEL = nls.localize('openIntroductoryVideosUrl', "Introductory Videos"); + + private static URL = product.introductoryVideosUrl; + public static AVAILABLE = !!OpenIntroductoryVideosUrlAction.URL; + + constructor( + id: string, + label: string + ) { + super(id, label); + } + + public run(): TPromise { + window.open(OpenIntroductoryVideosUrlAction.URL); + return null; + } +} + // --- commands CommandsRegistry.registerCommand('_workbench.diff', function (accessor: ServicesAccessor, args: [URI, URI, string, string]) { diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index 8ceacfc882b..c1224b5b0c1 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -19,7 +19,7 @@ import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRe import { IPartService } from 'vs/workbench/services/part/common/partService'; import { CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions'; import { IWindowIPCService } from 'vs/workbench/services/window/electron-browser/windowService'; -import { CloseEditorAction, KeybindingsReferenceAction, OpenDocumentationUrlAction, ReportIssueAction, ReportPerformanceIssueAction, ZoomResetAction, ZoomOutAction, ZoomInAction, ToggleFullScreenAction, ToggleMenuBarAction, CloseFolderAction, CloseWindowAction, SwitchWindow, NewWindowAction, CloseMessagesAction } from 'vs/workbench/electron-browser/actions'; +import { CloseEditorAction, KeybindingsReferenceAction, OpenDocumentationUrlAction, OpenIntroductoryVideosUrlAction, ReportIssueAction, ReportPerformanceIssueAction, ZoomResetAction, ZoomOutAction, ZoomInAction, ToggleFullScreenAction, ToggleMenuBarAction, CloseFolderAction, CloseWindowAction, SwitchWindow, NewWindowAction, CloseMessagesAction } from 'vs/workbench/electron-browser/actions'; import { MessagesVisibleContext, NoEditorsVisibleContext, InZenModeContext } from 'vs/workbench/electron-browser/workbench'; import { IJSONSchema } from 'vs/base/common/jsonSchema'; import { IWindowsService } from 'vs/platform/windows/common/windows'; @@ -45,6 +45,9 @@ if (KeybindingsReferenceAction.AVAILABLE) { if (OpenDocumentationUrlAction.AVAILABLE) { workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenDocumentationUrlAction, OpenDocumentationUrlAction.ID, OpenDocumentationUrlAction.LABEL), 'Help: Documentation', helpCategory); } +if (OpenIntroductoryVideosUrlAction.AVAILABLE) { + workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenIntroductoryVideosUrlAction, OpenIntroductoryVideosUrlAction.ID, OpenIntroductoryVideosUrlAction.LABEL), 'Help: Introductory Videos', helpCategory); +} workbenchActionsRegistry.registerWorkbenchAction( new SyncActionDescriptor(ZoomInAction, ZoomInAction.ID, ZoomInAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.US_EQUAL, diff --git a/src/vs/workbench/parts/welcomePage/electron-browser/welcomePage.html b/src/vs/workbench/parts/welcomePage/electron-browser/welcomePage.html index 242b61aaf69..53e8e53cd07 100644 --- a/src/vs/workbench/parts/welcomePage/electron-browser/welcomePage.html +++ b/src/vs/workbench/parts/welcomePage/electron-browser/welcomePage.html @@ -23,7 +23,7 @@

Help