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

fixes #14487

上级 5ea2e04f
......@@ -490,6 +490,12 @@ export class WindowsManager implements IWindowsService {
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.sendToFocused('vscode:telemetry', { eventName: 'update:downloaded', data: { version: update.version } });
......
......@@ -34,7 +34,7 @@ import * as browser from 'vs/base/browser/browser';
import { IIntegrityService } from 'vs/platform/integrity/common/integrity';
import * as os from 'os';
import { ipcRenderer as ipc, webFrame, remote, shell } from 'electron';
import { ipcRenderer as ipc, webFrame, remote } from 'electron';
// --- actions
......@@ -548,7 +548,7 @@ export class ReportIssueAction extends Action {
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);
shell.openExternal(issueUrl);
window.open(issueUrl);
return TPromise.as(true);
});
......
......@@ -17,7 +17,7 @@ import { asFileEditorInput } from 'vs/workbench/common/editor';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
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;
......@@ -120,7 +120,7 @@ export class ElectronWindow {
// Handle window.open() calls
(<any>window).open = function (url: string, target: string, features: string, replace: boolean) {
shell.openExternal(url);
$this.openExternal(url);
return null;
};
......@@ -187,4 +187,8 @@ export class ElectronWindow {
public showItemInFolder(path: string): void {
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
import { TerminalSupport } from 'vs/workbench/parts/debug/electron-browser/terminalSupport';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { shell } from 'electron';
export interface SessionExitedEvent extends DebugProtocol.ExitedEvent {
body: {
exitCode: number,
......@@ -175,7 +173,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession {
const label = error.urlLabel ? error.urlLabel : nls.localize('moreInfo', "More Info");
return TPromise.wrapError(errors.create(userMessage, {
actions: [CloseAction, new Action('debug.moreInfo', label, null, true, () => {
shell.openExternal(error.url);
window.open(error.url);
return TPromise.as(null);
})]
}));
......
......@@ -33,7 +33,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { ITemplateData } from './extensionsList';
import { RatingsWidget, InstallWidget } from './extensionsWidgets';
import { EditorOptions } from 'vs/workbench/common/editor';
import { shell } from 'electron';
import product from 'vs/platform/product';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { CombinedInstallAction, UpdateAction, EnableAction, DisableAction, ReloadAction, BuiltinStatusLabelAction } from './extensionsActions';
......@@ -236,8 +235,8 @@ export class ExtensionEditor extends BaseEditor {
if (product.extensionsGallery) {
const extensionUrl = `${product.extensionsGallery.itemUrl}?itemName=${extension.publisher}.${extension.name}`;
this.name.onclick = finalHandler(() => shell.openExternal(extensionUrl));
this.rating.onclick = finalHandler(() => shell.openExternal(`${extensionUrl}#review-details`));
this.name.onclick = finalHandler(() => window.open(extensionUrl));
this.rating.onclick = finalHandler(() => window.open(`${extensionUrl}#review-details`));
this.publisher.onclick = finalHandler(() => {
this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet as IExtensionsViewlet)
......@@ -245,7 +244,7 @@ export class ExtensionEditor extends BaseEditor {
});
if (extension.licenseUrl) {
this.license.onclick = finalHandler(() => shell.openExternal(extension.licenseUrl));
this.license.onclick = finalHandler(() => window.open(extension.licenseUrl));
this.license.style.display = 'initial';
} else {
this.license.onclick = null;
......
......@@ -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 { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { shell } from 'electron';
import product from 'vs/platform/product';
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 url = TwitterFeedbackService.TWITTER_URL + queryString;
shell.openExternal(url);
window.open(url);
}
public getCharacterLimit(sentiment: number): number {
......
......@@ -36,7 +36,6 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import URI from 'vs/base/common/uri';
import * as semver from 'semver';
import { shell } from 'electron';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import Event from 'vs/base/common/event';
import { domEvent } from 'vs/base/browser/event';
......@@ -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),
actions: [
new Action('downloadLatest', localize('download', "Download"), '', true, () => {
shell.openExternal('https://git-scm.com/');
window.open('https://git-scm.com/');
return null;
}),
new Action('neverShowAgain', localize('neverShowAgain', "Don't show again"), null, true, () => {
......
......@@ -6,7 +6,6 @@
'use strict';
import * as nls from 'vs/nls';
import { shell } from 'electron';
import { TPromise } from 'vs/base/common/winjs.base';
import { Action } from 'vs/base/common/actions';
import { language } from 'vs/base/common/platform';
......@@ -68,7 +67,7 @@ class NPSContribution implements IWorkbenchContribution {
const takeSurveyAction = new Action('nps.takeSurvey', nls.localize('takeSurvey', "Take Survey"), '', true, () => {
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(SKIP_VERSION_KEY, pkg.version, StorageScope.GLOBAL);
});
......
......@@ -9,7 +9,7 @@ import nls = require('vs/nls');
import severity from 'vs/base/common/severity';
import { TPromise } from 'vs/base/common/winjs.base';
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 pkg from 'vs/platform/package';
import product from 'vs/platform/product';
......@@ -178,12 +178,12 @@ export const DownloadAction = (url: string) => new Action(
nls.localize('downloadNow', "Download Now"),
null,
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(
id, message, null, true,
() => { shell.openExternal(licenseUrl); return TPromise.as(null); }
() => { window.open(licenseUrl); return TPromise.as(null); }
);
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),
actions: [
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);
return TPromise.as(null);
}),
......
......@@ -8,8 +8,6 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { AbstractGettingStarted } from 'vs/workbench/parts/welcome/common/abstractGettingStarted';
import * as platform from 'vs/base/common/platform';
import { shell } from 'electron';
export class ElectronGettingStarted extends AbstractGettingStarted implements IWorkbenchContribution {
protected openExternal(url: string) {
......@@ -18,7 +16,7 @@ export class ElectronGettingStarted extends AbstractGettingStarted implements IW
if (platform.isLinux && platform.isRootUser) {
return;
}
shell.openExternal(url);
window.open(url);
}
protected handleWelcome(): void {
......
......@@ -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."),
actions: [
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);
}),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册