add IWindowService#relaunch
This commit is contained in:
parent
68d37dac12
commit
a8d477482e
|
@ -37,6 +37,7 @@ export interface IWindowsService {
|
||||||
unmaximizeWindow(windowId: number): TPromise<void>;
|
unmaximizeWindow(windowId: number): TPromise<void>;
|
||||||
setDocumentEdited(windowId: number, flag: boolean): TPromise<void>;
|
setDocumentEdited(windowId: number, flag: boolean): TPromise<void>;
|
||||||
quit(): TPromise<void>;
|
quit(): TPromise<void>;
|
||||||
|
relaunch(options: { addArgs?: string[], removeArgs?: string[] }): TPromise<void>;
|
||||||
|
|
||||||
// Global methods
|
// Global methods
|
||||||
openWindow(paths: string[], options?: { forceNewWindow?: boolean, forceReuseWindow?: boolean }): TPromise<void>;
|
openWindow(paths: string[], options?: { forceNewWindow?: boolean, forceReuseWindow?: boolean }): TPromise<void>;
|
||||||
|
@ -95,4 +96,4 @@ export interface IWindowSettings {
|
||||||
autoDetectHighContrast: boolean;
|
autoDetectHighContrast: boolean;
|
||||||
menuBarVisibility: MenuBarVisibility;
|
menuBarVisibility: MenuBarVisibility;
|
||||||
newWindowDimensions: 'default' | 'inherit' | 'maximized' | 'fullscreen';
|
newWindowDimensions: 'default' | 'inherit' | 'maximized' | 'fullscreen';
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,7 @@ export class WindowsChannel implements IWindowsChannel {
|
||||||
case 'showWindow': return this.service.showWindow(arg);
|
case 'showWindow': return this.service.showWindow(arg);
|
||||||
case 'getWindows': return this.service.getWindows();
|
case 'getWindows': return this.service.getWindows();
|
||||||
case 'getWindowCount': return this.service.getWindowCount();
|
case 'getWindowCount': return this.service.getWindowCount();
|
||||||
|
case 'relaunch': return this.service.relaunch(arg[0]);
|
||||||
case 'quit': return this.service.quit();
|
case 'quit': return this.service.quit();
|
||||||
case 'log': return this.service.log(arg[0], arg[1]);
|
case 'log': return this.service.log(arg[0], arg[1]);
|
||||||
case 'closeExtensionHostWindow': return this.service.closeExtensionHostWindow(arg);
|
case 'closeExtensionHostWindow': return this.service.closeExtensionHostWindow(arg);
|
||||||
|
@ -175,6 +176,10 @@ export class WindowsChannelClient implements IWindowsService {
|
||||||
return this.channel.call('quit');
|
return this.channel.call('quit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
relaunch(options: { addArgs?: string[], removeArgs?: string[] }): TPromise<void> {
|
||||||
|
return this.channel.call('relaunch', [options]);
|
||||||
|
}
|
||||||
|
|
||||||
openWindow(paths: string[], options?: { forceNewWindow?: boolean, forceReuseWindow?: boolean }): TPromise<void> {
|
openWindow(paths: string[], options?: { forceNewWindow?: boolean, forceReuseWindow?: boolean }): TPromise<void> {
|
||||||
return this.channel.call('openWindow', [paths, options]);
|
return this.channel.call('openWindow', [paths, options]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,6 +264,24 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||||
return TPromise.as(null);
|
return TPromise.as(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
relaunch(options: { addArgs?: string[], removeArgs?: string[] }): TPromise<void> {
|
||||||
|
const args = process.argv.slice(1);
|
||||||
|
if (options.addArgs) {
|
||||||
|
args.push(...options.addArgs);
|
||||||
|
}
|
||||||
|
if (options.removeArgs) {
|
||||||
|
for (const a of options.removeArgs) {
|
||||||
|
const idx = args.indexOf(a);
|
||||||
|
if (idx >= 0) {
|
||||||
|
args.splice(idx, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
app.quit();
|
||||||
|
app.once('quit', () => app.relaunch({ args }));
|
||||||
|
return TPromise.as(null);
|
||||||
|
}
|
||||||
|
|
||||||
private openFileForURI(filePath: string): TPromise<void> {
|
private openFileForURI(filePath: string): TPromise<void> {
|
||||||
const cli = assign(Object.create(null), this.environmentService.args, { goto: true });
|
const cli = assign(Object.create(null), this.environmentService.args, { goto: true });
|
||||||
const pathsToOpen = [filePath];
|
const pathsToOpen = [filePath];
|
||||||
|
|
|
@ -917,6 +917,10 @@ export class TestWindowsService implements IWindowsService {
|
||||||
return TPromise.as(void 0);
|
return TPromise.as(void 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
relaunch(options: { addArgs?: string[], removeArgs?: string[] }): TPromise<void> {
|
||||||
|
return TPromise.as(void 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Global methods
|
// Global methods
|
||||||
openWindow(paths: string[], options?: { forceNewWindow?: boolean, forceReuseWindow?: boolean }): TPromise<void> {
|
openWindow(paths: string[], options?: { forceNewWindow?: boolean, forceReuseWindow?: boolean }): TPromise<void> {
|
||||||
return TPromise.as(void 0);
|
return TPromise.as(void 0);
|
||||||
|
|
Loading…
Reference in a new issue