提交 aed0b7ac 编写于 作者: B Benjamin Pasero

fixes #2814

上级 32c95a76
......@@ -18,7 +18,7 @@ import { EventEmitter } from 'events';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IStorageService } from 'vs/code/electron-main/storage';
import { IPath, VSCodeWindow, ReadyState, IWindowConfiguration, IWindowState as ISingleWindowState, defaultWindowState, IWindowSettings } from 'vs/code/electron-main/window';
import { ipcMain as ipc, app, screen, crashReporter, BrowserWindow, dialog } from 'electron';
import { ipcMain as ipc, app, screen, crashReporter, BrowserWindow, dialog, shell } from 'electron';
import { IPathWithLineAndColumn, parseLineAndColumnAware } from 'vs/code/electron-main/paths';
import { ILifecycleService } from 'vs/code/electron-main/lifecycle';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
......@@ -484,6 +484,12 @@ export class WindowsManager implements IWindowsService {
}));
});
ipc.on('vscode:showItemInFolder', (event, path: string) => {
this.logService.log('IPC#vscode-showItemInFolder');
shell.showItemInFolder(path);
});
this.updateService.on('update-downloaded', (update: IUpdate) => {
this.sendToFocused('vscode:telemetry', { eventName: 'update:downloaded', data: { version: update.version } });
......
......@@ -183,4 +183,8 @@ export class ElectronWindow {
public flashFrame(): void {
ipc.send('vscode:flashFrame', this.windowId); // handled from browser process
}
public showItemInFolder(path: string): void {
ipc.send('vscode:showItemInFolder', path); // handled from browser process to prevent foreground ordering issues on Windows
}
}
\ No newline at end of file
......@@ -24,12 +24,13 @@ import { ToggleViewletAction } from 'vs/workbench/browser/viewlet';
import { IViewletService } from 'vs/workbench/services/viewlet/common/viewletService';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { Query } from '../common/extensionQuery';
import { shell, remote } from 'electron';
import { remote } from 'electron';
import { ExtensionsConfigurationInitialContent } from 'vs/workbench/parts/extensions/electron-browser/extensionsFileTemplate';
import { IFileService } from 'vs/platform/files/common/files';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import URI from 'vs/base/common/uri';
import { IExtensionsRuntimeService } from 'vs/platform/extensions/common/extensions';
import { IWindowService } from 'vs/workbench/services/window/electron-browser/windowService';
const dialog = remote.dialog;
......@@ -1022,6 +1023,7 @@ export class OpenExtensionsFolderAction extends Action {
constructor(
id: string,
label: string,
@IWindowService private windowService: IWindowService,
@IEnvironmentService private environmentService: IEnvironmentService
) {
super(id, label, null, true);
......@@ -1029,7 +1031,7 @@ export class OpenExtensionsFolderAction extends Action {
run(): TPromise<any> {
const extensionsHome = this.environmentService.extensionsPath;
shell.showItemInFolder(paths.normalize(extensionsHome, true));
this.windowService.getWindow().showItemInFolder(paths.normalize(extensionsHome, true));
return TPromise.as(true);
}
......
......@@ -17,13 +17,17 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi
import { asFileEditorInput } from 'vs/workbench/common/editor';
import { IMessageService } from 'vs/platform/message/common/message';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IWindowService } from 'vs/workbench/services/window/electron-browser/windowService';
import { ipcRenderer as ipc, shell, clipboard } from 'electron';
import { ipcRenderer as ipc, clipboard } from 'electron';
export class RevealInOSAction extends Action {
private resource: uri;
constructor(resource: uri) {
constructor(
resource: uri,
@IWindowService private windowService: IWindowService
) {
super('workbench.action.files.revealInWindows', platform.isWindows ? nls.localize('revealInWindows', "Reveal in Explorer") : (platform.isMacintosh ? nls.localize('revealInMac', "Reveal in Finder") : nls.localize('openContainer', "Open Containing Folder")));
this.resource = resource;
......@@ -32,7 +36,7 @@ export class RevealInOSAction extends Action {
}
public run(): TPromise<any> {
shell.showItemInFolder(paths.normalize(this.resource.fsPath, true));
this.windowService.getWindow().showItemInFolder(paths.normalize(this.resource.fsPath, true));
return TPromise.as(true);
}
......@@ -47,6 +51,7 @@ export class GlobalRevealInOSAction extends Action {
id: string,
label: string,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IWindowService private windowService: IWindowService,
@IMessageService private messageService: IMessageService
) {
super(id, label);
......@@ -55,7 +60,7 @@ export class GlobalRevealInOSAction extends Action {
public run(): TPromise<any> {
const fileInput = asFileEditorInput(this.editorService.getActiveEditorInput(), true);
if (fileInput) {
shell.showItemInFolder(paths.normalize(fileInput.getResource().fsPath, true));
this.windowService.getWindow().showItemInFolder(paths.normalize(fileInput.getResource().fsPath, true));
} else {
this.messageService.show(severity.Info, nls.localize('openFileToReveal', "Open a file first to reveal"));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册