提交 c2514ed1 编写于 作者: J Joao Moreno

ipc: remove vscode:setDocumentEdited

#10587
上级 8777f080
......@@ -231,15 +231,6 @@ export class WindowsManager implements IWindowsMainService, IWindowEventService
}
});
ipc.on('vscode:setDocumentEdited', (event, windowId: number, edited: boolean) => {
this.logService.log('IPC#vscode:setDocumentEdited');
const vscodeWindow = this.getWindowById(windowId);
if (vscodeWindow && vscodeWindow.win.isDocumentEdited() !== edited) {
vscodeWindow.win.setDocumentEdited(edited);
}
});
ipc.on('vscode:toggleMenuBar', (event, windowId: number) => {
this.logService.log('IPC#vscode:toggleMenuBar');
......
......@@ -26,6 +26,7 @@ export interface IWindowsService {
setRepresentedFilename(windowId: number, fileName: string): TPromise<void>;
getRecentlyOpen(windowId: number): TPromise<{ files: string[]; folders: string[]; }>;
focusWindow(windowId: number): TPromise<void>;
setDocumentEdited(windowId: number, flag: boolean): TPromise<void>;
// Global methods
// TODO@joao: rename, shouldn't this be openWindow?
......@@ -53,4 +54,5 @@ export interface IWindowService {
setRepresentedFilename(fileName: string): TPromise<void>;
getRecentlyOpen(): TPromise<{ files: string[]; folders: string[]; }>;
focusWindow(): TPromise<void>;
setDocumentEdited(flag: boolean): TPromise<void>;
}
\ No newline at end of file
......@@ -20,6 +20,7 @@ export interface IWindowsChannel extends IChannel {
call(command: 'setRepresentedFilename', arg: [number, string]): TPromise<void>;
call(command: 'getRecentlyOpen', arg: number): TPromise<{ files: string[]; folders: string[]; }>;
call(command: 'focusWindow', arg: number): TPromise<void>;
call(command: 'setDocumentEdited', args: [number, boolean]): TPromise<void>;
call(command: 'windowOpen', arg: [string[], boolean]): TPromise<void>;
call(command: 'openNewWindow'): TPromise<void>;
call(command: 'showWindow', arg: number): TPromise<void>;
......@@ -44,6 +45,7 @@ export class WindowsChannel implements IWindowsChannel {
case 'setRepresentedFilename': return this.service.setRepresentedFilename(arg[0], arg[1]);
case 'getRecentlyOpen': return this.service.getRecentlyOpen(arg);
case 'focusWindow': return this.service.focusWindow(arg);
case 'setDocumentEdited': return this.service.setDocumentEdited(arg[0], arg[1]);
case 'windowOpen': return this.service.windowOpen(arg[0], arg[1]);
case 'openNewWindow': return this.service.openNewWindow();
case 'showWindow': return this.service.showWindow(arg);
......@@ -102,6 +104,10 @@ export class WindowsChannelClient implements IWindowsService {
return this.channel.call('focusWindow', windowId);
}
setDocumentEdited(windowId: number, flag: boolean): TPromise<void> {
return this.channel.call('setDocumentEdited', [windowId, flag]);
}
windowOpen(paths: string[], forceNewWindow?: boolean): TPromise<void> {
return this.channel.call('windowOpen', [paths, forceNewWindow]);
}
......
......@@ -64,4 +64,8 @@ export class WindowService implements IWindowService {
focusWindow(): TPromise<void> {
return this.windowsService.focusWindow(this.windowId);
}
setDocumentEdited(flag: boolean): TPromise<void> {
return this.windowsService.setDocumentEdited(this.windowId, flag);
}
}
\ No newline at end of file
......@@ -117,6 +117,16 @@ export class WindowsService implements IWindowsService {
return TPromise.as(null);
}
setDocumentEdited(windowId: number, flag: boolean): TPromise<void> {
const vscodeWindow = this.windowsMainService.getWindowById(windowId);
if (vscodeWindow && vscodeWindow.win.isDocumentEdited() !== flag) {
vscodeWindow.win.setDocumentEdited(flag);
}
return TPromise.as(null);
}
windowOpen(paths: string[], forceNewWindow?: boolean): TPromise<void> {
if (!paths || !paths.length) {
return TPromise.as(null);
......
......@@ -11,8 +11,8 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { VIEWLET_ID } from 'vs/workbench/parts/files/common/files';
import { TextFileModelChangeEvent, ITextFileService, AutoSaveMode } from 'vs/workbench/services/textfile/common/textfiles';
import { platform, Platform } from 'vs/base/common/platform';
import { IWindowIPCService } from 'vs/workbench/services/window/electron-browser/windowService';
import { Position } from 'vs/platform/editor/common/editor';
import { IWindowService } from 'vs/platform/windows/common/windows';
import { IEditorStacksModel } from 'vs/workbench/common/editor';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
......@@ -23,8 +23,6 @@ import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/co
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import arrays = require('vs/base/common/arrays');
import { ipcRenderer as ipc } from 'electron';
export class DirtyFilesTracker implements IWorkbenchContribution {
private isDocumentedEdited: boolean;
private toUnbind: IDisposable[];
......@@ -41,7 +39,7 @@ export class DirtyFilesTracker implements IWorkbenchContribution {
@IEditorGroupService editorGroupService: IEditorGroupService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IActivityService private activityService: IActivityService,
@IWindowIPCService private windowService: IWindowIPCService,
@IWindowService private windowService: IWindowService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService
) {
this.toUnbind = [];
......@@ -161,7 +159,7 @@ export class DirtyFilesTracker implements IWorkbenchContribution {
const hasDirtyFiles = this.textFileService.isDirty();
this.isDocumentedEdited = hasDirtyFiles;
ipc.send('vscode:setDocumentEdited', this.windowService.getWindowId(), hasDirtyFiles); // handled from browser process
this.windowService.setDocumentEdited(hasDirtyFiles);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册