提交 712e4fe7 编写于 作者: J Joao Moreno

ipc: remove vscode:showItemInFolder

#10587
上级 955c2468
......@@ -255,12 +255,6 @@ export class WindowsManager implements IWindowsMainService, IWindowEventService
}
});
ipc.on('vscode:showItemInFolder', (event, path: string) => {
this.logService.log('IPC#vscode-showItemInFolder');
shell.showItemInFolder(path);
});
ipc.on('vscode:openExternal', (event, url: string) => {
this.logService.log('IPC#vscode-openExternal');
......
......@@ -38,6 +38,7 @@ export interface IWindowsService {
log(severity: string, ...messages: string[]): TPromise<void>;
// TODO@joao: what?
closeExtensionHostWindow(extensionDevelopmentPath: string): TPromise<void>;
showItemInFolder(path: string): TPromise<void>;
}
export const IWindowService = createDecorator<IWindowService>('windowService');
......
......@@ -28,6 +28,7 @@ export interface IWindowsChannel extends IChannel {
call(command: 'getWindows'): TPromise<{ id: number; path: string; title: string; }[]>;
call(command: 'log', args: [string, string[]]): TPromise<void>;
call(command: 'closeExtensionHostWindow', args: string): TPromise<void>;
call(command: 'showItemInFolder', args: string): TPromise<void>;
call(command: string, arg?: any): TPromise<any>;
}
......@@ -56,6 +57,7 @@ export class WindowsChannel implements IWindowsChannel {
case 'getWindows': return this.service.getWindows();
case 'log': return this.service.log(arg[0], arg[1]);
case 'closeExtensionHostWindow': return this.service.closeExtensionHostWindow(arg);
case 'showItemInFolder': return this.service.showItemInFolder(arg);
}
}
}
......@@ -141,4 +143,8 @@ export class WindowsChannelClient implements IWindowsService {
closeExtensionHostWindow(extensionDevelopmentPath: string): TPromise<void> {
return this.channel.call('closeExtensionHostWindow', extensionDevelopmentPath);
}
showItemInFolder(path: string): TPromise<void> {
return this.channel.call('showItemInFolder', path);
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@
import { TPromise } from 'vs/base/common/winjs.base';
import { IWindowsService } from 'vs/platform/windows/common/windows';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { shell } from 'electron';
// TODO@Joao: remove this dependency, move all implementation to this class
import { IWindowsMainService } from 'vs/code/electron-main/windows';
......@@ -176,4 +177,9 @@ export class WindowsService implements IWindowsService {
return TPromise.as(null);
}
showItemInFolder(path: string): TPromise<void> {
shell.showItemInFolder(path);
return TPromise.as(null);
}
}
\ No newline at end of file
......@@ -158,10 +158,6 @@ export class ElectronWindow {
return this.windowService.focusWindow();
}
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
}
......
......@@ -14,7 +14,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IMessageService } from 'vs/platform/message/common/message';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { remote } from 'electron';
import { IWindowIPCService } from 'vs/workbench/services/window/electron-browser/windowService';
import { IWindowsService } from 'vs/platform/windows/common/windows';
const dialog = remote.dialog;
......@@ -26,17 +26,15 @@ export class OpenExtensionsFolderAction extends Action {
constructor(
id: string,
label: string,
@IWindowIPCService private windowService: IWindowIPCService,
@IWindowsService private windowsService: IWindowsService,
@IEnvironmentService private environmentService: IEnvironmentService
) {
super(id, label, null, true);
}
run(): TPromise<any> {
run(): TPromise<void> {
const extensionsHome = this.environmentService.extensionsPath;
this.windowService.getWindow().showItemInFolder(paths.normalize(extensionsHome, true));
return TPromise.as(true);
return this.windowsService.showItemInFolder(paths.normalize(extensionsHome, true));
}
protected isEnabled(): boolean {
......
......@@ -17,7 +17,6 @@ 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 { IWindowIPCService } from 'vs/workbench/services/window/electron-browser/windowService';
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
import { clipboard } from 'electron';
......@@ -26,7 +25,7 @@ export class RevealInOSAction extends Action {
constructor(
resource: uri,
@IWindowIPCService private windowService: IWindowIPCService
@IWindowsService private windowsService: IWindowsService
) {
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")));
......@@ -36,7 +35,7 @@ export class RevealInOSAction extends Action {
}
public run(): TPromise<any> {
this.windowService.getWindow().showItemInFolder(paths.normalize(this.resource.fsPath, true));
this.windowsService.showItemInFolder(paths.normalize(this.resource.fsPath, true));
return TPromise.as(true);
}
......@@ -51,7 +50,7 @@ export class GlobalRevealInOSAction extends Action {
id: string,
label: string,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IWindowIPCService private windowService: IWindowIPCService,
@IWindowsService private windowsService: IWindowsService,
@IMessageService private messageService: IMessageService
) {
super(id, label);
......@@ -60,7 +59,7 @@ export class GlobalRevealInOSAction extends Action {
public run(): TPromise<any> {
const fileInput = asFileEditorInput(this.editorService.getActiveEditorInput(), true);
if (fileInput) {
this.windowService.getWindow().showItemInFolder(paths.normalize(fileInput.getResource().fsPath, true));
this.windowsService.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.
先完成此消息的编辑!
想要评论请 注册