提交 5d047765 编写于 作者: B Benjamin Pasero

fixes #14487

上级 5ea2e04f
...@@ -490,6 +490,12 @@ export class WindowsManager implements IWindowsService { ...@@ -490,6 +490,12 @@ export class WindowsManager implements IWindowsService {
shell.showItemInFolder(path); shell.showItemInFolder(path);
}); });
ipc.on('vscode:openExternal', (event, url: string) => {
this.logService.log('IPC#vscode-openExternal');
shell.openExternal(url);
});
this.updateService.on('update-downloaded', (update: IUpdate) => { this.updateService.on('update-downloaded', (update: IUpdate) => {
this.sendToFocused('vscode:telemetry', { eventName: 'update:downloaded', data: { version: update.version } }); this.sendToFocused('vscode:telemetry', { eventName: 'update:downloaded', data: { version: update.version } });
......
...@@ -34,7 +34,7 @@ import * as browser from 'vs/base/browser/browser'; ...@@ -34,7 +34,7 @@ import * as browser from 'vs/base/browser/browser';
import { IIntegrityService } from 'vs/platform/integrity/common/integrity'; import { IIntegrityService } from 'vs/platform/integrity/common/integrity';
import * as os from 'os'; import * as os from 'os';
import { ipcRenderer as ipc, webFrame, remote, shell } from 'electron'; import { ipcRenderer as ipc, webFrame, remote } from 'electron';
// --- actions // --- actions
...@@ -548,7 +548,7 @@ export class ReportIssueAction extends Action { ...@@ -548,7 +548,7 @@ export class ReportIssueAction extends Action {
return this.extensionManagementService.getInstalled(LocalExtensionType.User).then(extensions => { return this.extensionManagementService.getInstalled(LocalExtensionType.User).then(extensions => {
const issueUrl = this.generateNewIssueUrl(product.reportIssueUrl, pkg.name, pkg.version, product.commit, product.date, res.isPure, extensions); const issueUrl = this.generateNewIssueUrl(product.reportIssueUrl, pkg.name, pkg.version, product.commit, product.date, res.isPure, extensions);
shell.openExternal(issueUrl); window.open(issueUrl);
return TPromise.as(true); return TPromise.as(true);
}); });
......
...@@ -17,7 +17,7 @@ import { asFileEditorInput } from 'vs/workbench/common/editor'; ...@@ -17,7 +17,7 @@ import { asFileEditorInput } from 'vs/workbench/common/editor';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService'; import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { ipcRenderer as ipc, shell, remote } from 'electron'; import { ipcRenderer as ipc, remote } from 'electron';
const dialog = remote.dialog; const dialog = remote.dialog;
...@@ -120,7 +120,7 @@ export class ElectronWindow { ...@@ -120,7 +120,7 @@ export class ElectronWindow {
// Handle window.open() calls // Handle window.open() calls
(<any>window).open = function (url: string, target: string, features: string, replace: boolean) { (<any>window).open = function (url: string, target: string, features: string, replace: boolean) {
shell.openExternal(url); $this.openExternal(url);
return null; return null;
}; };
...@@ -187,4 +187,8 @@ export class ElectronWindow { ...@@ -187,4 +187,8 @@ export class ElectronWindow {
public showItemInFolder(path: string): void { public showItemInFolder(path: string): void {
ipc.send('vscode:showItemInFolder', path); // handled from browser process to prevent foreground ordering issues on Windows ipc.send('vscode:showItemInFolder', path); // handled from browser process to prevent foreground ordering issues on Windows
} }
public openExternal(url: string): void {
ipc.send('vscode:openExternal', url); // handled from browser process to prevent foreground ordering issues on Windows
}
} }
\ No newline at end of file
...@@ -27,8 +27,6 @@ import { ExtensionsChannelId } from 'vs/platform/extensionManagement/common/exte ...@@ -27,8 +27,6 @@ import { ExtensionsChannelId } from 'vs/platform/extensionManagement/common/exte
import { TerminalSupport } from 'vs/workbench/parts/debug/electron-browser/terminalSupport'; import { TerminalSupport } from 'vs/workbench/parts/debug/electron-browser/terminalSupport';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { shell } from 'electron';
export interface SessionExitedEvent extends DebugProtocol.ExitedEvent { export interface SessionExitedEvent extends DebugProtocol.ExitedEvent {
body: { body: {
exitCode: number, exitCode: number,
...@@ -175,7 +173,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession { ...@@ -175,7 +173,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession {
const label = error.urlLabel ? error.urlLabel : nls.localize('moreInfo', "More Info"); const label = error.urlLabel ? error.urlLabel : nls.localize('moreInfo', "More Info");
return TPromise.wrapError(errors.create(userMessage, { return TPromise.wrapError(errors.create(userMessage, {
actions: [CloseAction, new Action('debug.moreInfo', label, null, true, () => { actions: [CloseAction, new Action('debug.moreInfo', label, null, true, () => {
shell.openExternal(error.url); window.open(error.url);
return TPromise.as(null); return TPromise.as(null);
})] })]
})); }));
......
...@@ -33,7 +33,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur ...@@ -33,7 +33,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { ITemplateData } from './extensionsList'; import { ITemplateData } from './extensionsList';
import { RatingsWidget, InstallWidget } from './extensionsWidgets'; import { RatingsWidget, InstallWidget } from './extensionsWidgets';
import { EditorOptions } from 'vs/workbench/common/editor'; import { EditorOptions } from 'vs/workbench/common/editor';
import { shell } from 'electron';
import product from 'vs/platform/product'; import product from 'vs/platform/product';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar'; import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { CombinedInstallAction, UpdateAction, EnableAction, DisableAction, ReloadAction, BuiltinStatusLabelAction } from './extensionsActions'; import { CombinedInstallAction, UpdateAction, EnableAction, DisableAction, ReloadAction, BuiltinStatusLabelAction } from './extensionsActions';
...@@ -236,8 +235,8 @@ export class ExtensionEditor extends BaseEditor { ...@@ -236,8 +235,8 @@ export class ExtensionEditor extends BaseEditor {
if (product.extensionsGallery) { if (product.extensionsGallery) {
const extensionUrl = `${product.extensionsGallery.itemUrl}?itemName=${extension.publisher}.${extension.name}`; const extensionUrl = `${product.extensionsGallery.itemUrl}?itemName=${extension.publisher}.${extension.name}`;
this.name.onclick = finalHandler(() => shell.openExternal(extensionUrl)); this.name.onclick = finalHandler(() => window.open(extensionUrl));
this.rating.onclick = finalHandler(() => shell.openExternal(`${extensionUrl}#review-details`)); this.rating.onclick = finalHandler(() => window.open(`${extensionUrl}#review-details`));
this.publisher.onclick = finalHandler(() => { this.publisher.onclick = finalHandler(() => {
this.viewletService.openViewlet(VIEWLET_ID, true) this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet as IExtensionsViewlet) .then(viewlet => viewlet as IExtensionsViewlet)
...@@ -245,7 +244,7 @@ export class ExtensionEditor extends BaseEditor { ...@@ -245,7 +244,7 @@ export class ExtensionEditor extends BaseEditor {
}); });
if (extension.licenseUrl) { if (extension.licenseUrl) {
this.license.onclick = finalHandler(() => shell.openExternal(extension.licenseUrl)); this.license.onclick = finalHandler(() => window.open(extension.licenseUrl));
this.license.style.display = 'initial'; this.license.style.display = 'initial';
} else { } else {
this.license.onclick = null; this.license.onclick = null;
......
...@@ -10,7 +10,6 @@ import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar'; ...@@ -10,7 +10,6 @@ import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
import { FeedbackDropdown, IFeedback, IFeedbackService } from 'vs/workbench/parts/feedback/browser/feedback'; import { FeedbackDropdown, IFeedback, IFeedbackService } from 'vs/workbench/parts/feedback/browser/feedback';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { shell } from 'electron';
import product from 'vs/platform/product'; import product from 'vs/platform/product';
class TwitterFeedbackService implements IFeedbackService { class TwitterFeedbackService implements IFeedbackService {
...@@ -27,7 +26,7 @@ class TwitterFeedbackService implements IFeedbackService { ...@@ -27,7 +26,7 @@ class TwitterFeedbackService implements IFeedbackService {
const queryString = `?${feedback.sentiment === 1 ? `hashtags=${this.combineHashTagsAsString()}&` : null}ref_src=twsrc%5Etfw&related=twitterapi%2Ctwitter&text=${feedback.feedback}&tw_p=tweetbutton&via=${TwitterFeedbackService.VIA_NAME}`; const queryString = `?${feedback.sentiment === 1 ? `hashtags=${this.combineHashTagsAsString()}&` : null}ref_src=twsrc%5Etfw&related=twitterapi%2Ctwitter&text=${feedback.feedback}&tw_p=tweetbutton&via=${TwitterFeedbackService.VIA_NAME}`;
const url = TwitterFeedbackService.TWITTER_URL + queryString; const url = TwitterFeedbackService.TWITTER_URL + queryString;
shell.openExternal(url); window.open(url);
} }
public getCharacterLimit(sentiment: number): number { public getCharacterLimit(sentiment: number): number {
......
...@@ -36,7 +36,6 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace ...@@ -36,7 +36,6 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import URI from 'vs/base/common/uri'; import URI from 'vs/base/common/uri';
import * as semver from 'semver'; import * as semver from 'semver';
import { shell } from 'electron';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import Event from 'vs/base/common/event'; import Event from 'vs/base/common/event';
import { domEvent } from 'vs/base/browser/event'; import { domEvent } from 'vs/base/browser/event';
...@@ -483,7 +482,7 @@ export class GitService extends EventEmitter ...@@ -483,7 +482,7 @@ export class GitService extends EventEmitter
message: localize('updateGit', "You seem to have git {0} installed. Code works best with git >=2.0.0.", version), message: localize('updateGit', "You seem to have git {0} installed. Code works best with git >=2.0.0.", version),
actions: [ actions: [
new Action('downloadLatest', localize('download', "Download"), '', true, () => { new Action('downloadLatest', localize('download', "Download"), '', true, () => {
shell.openExternal('https://git-scm.com/'); window.open('https://git-scm.com/');
return null; return null;
}), }),
new Action('neverShowAgain', localize('neverShowAgain', "Don't show again"), null, true, () => { new Action('neverShowAgain', localize('neverShowAgain', "Don't show again"), null, true, () => {
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
'use strict'; 'use strict';
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
import { shell } from 'electron';
import { TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import { Action } from 'vs/base/common/actions'; import { Action } from 'vs/base/common/actions';
import { language } from 'vs/base/common/platform'; import { language } from 'vs/base/common/platform';
...@@ -68,7 +67,7 @@ class NPSContribution implements IWorkbenchContribution { ...@@ -68,7 +67,7 @@ class NPSContribution implements IWorkbenchContribution {
const takeSurveyAction = new Action('nps.takeSurvey', nls.localize('takeSurvey', "Take Survey"), '', true, () => { const takeSurveyAction = new Action('nps.takeSurvey', nls.localize('takeSurvey', "Take Survey"), '', true, () => {
return telemetryService.getTelemetryInfo().then(info => { return telemetryService.getTelemetryInfo().then(info => {
shell.openExternal(`${product.npsSurveyUrl}?o=${encodeURIComponent(process.platform)}&v=${encodeURIComponent(pkg.version)}&m=${encodeURIComponent(info.machineId)}`); window.open(`${product.npsSurveyUrl}?o=${encodeURIComponent(process.platform)}&v=${encodeURIComponent(pkg.version)}&m=${encodeURIComponent(info.machineId)}`);
storageService.store(IS_CANDIDATE_KEY, false, StorageScope.GLOBAL); storageService.store(IS_CANDIDATE_KEY, false, StorageScope.GLOBAL);
storageService.store(SKIP_VERSION_KEY, pkg.version, StorageScope.GLOBAL); storageService.store(SKIP_VERSION_KEY, pkg.version, StorageScope.GLOBAL);
}); });
......
...@@ -9,7 +9,7 @@ import nls = require('vs/nls'); ...@@ -9,7 +9,7 @@ import nls = require('vs/nls');
import severity from 'vs/base/common/severity'; import severity from 'vs/base/common/severity';
import { TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import { Action } from 'vs/base/common/actions'; import { Action } from 'vs/base/common/actions';
import { ipcRenderer as ipc, shell } from 'electron'; import { ipcRenderer as ipc } from 'electron';
import { IMessageService, CloseAction, Severity } from 'vs/platform/message/common/message'; import { IMessageService, CloseAction, Severity } from 'vs/platform/message/common/message';
import pkg from 'vs/platform/package'; import pkg from 'vs/platform/package';
import product from 'vs/platform/product'; import product from 'vs/platform/product';
...@@ -178,12 +178,12 @@ export const DownloadAction = (url: string) => new Action( ...@@ -178,12 +178,12 @@ export const DownloadAction = (url: string) => new Action(
nls.localize('downloadNow', "Download Now"), nls.localize('downloadNow', "Download Now"),
null, null,
true, true,
() => { shell.openExternal(url); return TPromise.as(true); } () => { window.open(url); return TPromise.as(true); }
); );
const LinkAction = (id: string, message: string, licenseUrl: string) => new Action( const LinkAction = (id: string, message: string, licenseUrl: string) => new Action(
id, message, null, true, id, message, null, true,
() => { shell.openExternal(licenseUrl); return TPromise.as(null); } () => { window.open(licenseUrl); return TPromise.as(null); }
); );
export class UpdateContribution implements IWorkbenchContribution { export class UpdateContribution implements IWorkbenchContribution {
...@@ -235,7 +235,7 @@ export class UpdateContribution implements IWorkbenchContribution { ...@@ -235,7 +235,7 @@ export class UpdateContribution implements IWorkbenchContribution {
message: nls.localize('insiderBuilds', "Insider builds and releases everyday!", product.nameLong, pkg.version), message: nls.localize('insiderBuilds', "Insider builds and releases everyday!", product.nameLong, pkg.version),
actions: [ actions: [
new Action('update.insiderBuilds', nls.localize('readmore', "Read More"), '', true, () => { new Action('update.insiderBuilds', nls.localize('readmore', "Read More"), '', true, () => {
shell.openExternal('http://go.microsoft.com/fwlink/?LinkID=798816'); window.open('http://go.microsoft.com/fwlink/?LinkID=798816');
storageService.store(UpdateContribution.INSIDER_KEY, false, StorageScope.GLOBAL); storageService.store(UpdateContribution.INSIDER_KEY, false, StorageScope.GLOBAL);
return TPromise.as(null); return TPromise.as(null);
}), }),
......
...@@ -8,8 +8,6 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; ...@@ -8,8 +8,6 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { AbstractGettingStarted } from 'vs/workbench/parts/welcome/common/abstractGettingStarted'; import { AbstractGettingStarted } from 'vs/workbench/parts/welcome/common/abstractGettingStarted';
import * as platform from 'vs/base/common/platform'; import * as platform from 'vs/base/common/platform';
import { shell } from 'electron';
export class ElectronGettingStarted extends AbstractGettingStarted implements IWorkbenchContribution { export class ElectronGettingStarted extends AbstractGettingStarted implements IWorkbenchContribution {
protected openExternal(url: string) { protected openExternal(url: string) {
...@@ -18,7 +16,7 @@ export class ElectronGettingStarted extends AbstractGettingStarted implements IW ...@@ -18,7 +16,7 @@ export class ElectronGettingStarted extends AbstractGettingStarted implements IW
if (platform.isLinux && platform.isRootUser) { if (platform.isLinux && platform.isRootUser) {
return; return;
} }
shell.openExternal(url); window.open(url);
} }
protected handleWelcome(): void { protected handleWelcome(): void {
......
...@@ -96,7 +96,7 @@ export class FileService implements IFileService { ...@@ -96,7 +96,7 @@ export class FileService implements IFileService {
message: nls.localize('netVersionError', "The Microsoft .NET Framework 4.5 is required. Please follow the link to install it."), message: nls.localize('netVersionError', "The Microsoft .NET Framework 4.5 is required. Please follow the link to install it."),
actions: [ actions: [
new Action('install.net', nls.localize('installNet', "Download .NET Framework 4.5"), null, true, () => { new Action('install.net', nls.localize('installNet', "Download .NET Framework 4.5"), null, true, () => {
shell.openExternal('https://go.microsoft.com/fwlink/?LinkId=786533'); window.open('https://go.microsoft.com/fwlink/?LinkId=786533');
return TPromise.as(true); return TPromise.as(true);
}), }),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册