Skip to content

Commit

Permalink
Add OpenIntroductoryVideosUrlAction (fixes microsoft#18862)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmarti committed Jan 20, 2017
1 parent a9777e8 commit 791c8fb
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/vs/code/electron-main/menus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
21 changes: 21 additions & 0 deletions src/vs/workbench/electron-browser/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
window.open(OpenIntroductoryVideosUrlAction.URL);
return null;
}
}

// --- commands

CommandsRegistry.registerCommand('_workbench.diff', function (accessor: ServicesAccessor, args: [URI, URI, string, string]) {
Expand Down
5 changes: 4 additions & 1 deletion src/vs/workbench/electron-browser/main.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h2>Recent</h2>
<h2>Help</h2>
<ul>
<li><a href="command:workbench.action.openDocumentationUrl">Product documentation</a></li>
<li><a href="command:workbench.action.openVideoUrl">Introductory videos</a></li>
<li><a href="command:workbench.action.openIntroductoryVideosUrl">Introductory videos</a></li>
<li><a href="https://github.com/Microsoft/vscode">GitHub repository</a></li>
<li><a href="http://stackoverflow.com/questions/tagged/vscode">Stack Overflow</a></li>
<!-- TODO: Use commands -->
Expand Down

0 comments on commit 791c8fb

Please sign in to comment.