windowService.ts 3.3 KB
Newer Older
J
Joao Moreno 已提交
1 2 3 4 5 6 7 8 9
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

'use strict';

import { TPromise } from 'vs/base/common/winjs.base';
import { IWindowService, IWindowsService } from 'vs/platform/windows/common/windows';
10
import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
J
Joao Moreno 已提交
11 12 13 14 15 16 17 18 19 20

export class WindowService implements IWindowService {

	_serviceBrand: any;

	constructor(
		private windowId: number,
		@IWindowsService private windowsService: IWindowsService
	) { }

J
Joao Moreno 已提交
21 22 23 24
	getCurrentWindowId(): number {
		return this.windowId;
	}

B
renames  
Benjamin Pasero 已提交
25 26
	pickFileFolderAndOpen(forceNewWindow?: boolean, data?: ITelemetryData): TPromise<void> {
		return this.windowsService.pickFileFolderAndOpen(this.windowId, forceNewWindow, data);
J
Joao Moreno 已提交
27 28
	}

B
renames  
Benjamin Pasero 已提交
29 30
	pickFileAndOpen(forceNewWindow?: boolean, path?: string, data?: ITelemetryData): TPromise<void> {
		return this.windowsService.pickFileAndOpen(this.windowId, forceNewWindow, path, data);
J
Joao Moreno 已提交
31 32
	}

B
renames  
Benjamin Pasero 已提交
33 34
	pickFolderAndOpen(forceNewWindow?: boolean, data?: ITelemetryData): TPromise<void> {
		return this.windowsService.pickFolderAndOpen(this.windowId, forceNewWindow, data);
J
Joao Moreno 已提交
35
	}
36

B
Benjamin Pasero 已提交
37
	pickFolder(options?: { buttonLabel: string; title: string; }): TPromise<string[]> {
38
		return this.windowsService.pickFolder(options);
39 40
	}

41 42 43
	reloadWindow(): TPromise<void> {
		return this.windowsService.reloadWindow(this.windowId);
	}
J
Joao Moreno 已提交
44

J
Joao Moreno 已提交
45 46 47 48
	openDevTools(): TPromise<void> {
		return this.windowsService.openDevTools(this.windowId);
	}

J
Joao Moreno 已提交
49 50 51
	toggleDevTools(): TPromise<void> {
		return this.windowsService.toggleDevTools(this.windowId);
	}
J
Joao Moreno 已提交
52 53 54 55

	closeFolder(): TPromise<void> {
		return this.windowsService.closeFolder(this.windowId);
	}
J
Joao Moreno 已提交
56

57 58 59 60
	closeWindow(): TPromise<void> {
		return this.windowsService.closeWindow(this.windowId);
	}

J
Joao Moreno 已提交
61 62 63
	toggleFullScreen(): TPromise<void> {
		return this.windowsService.toggleFullScreen(this.windowId);
	}
64 65 66 67

	setRepresentedFilename(fileName: string): TPromise<void> {
		return this.windowsService.setRepresentedFilename(this.windowId, fileName);
	}
J
Joao Moreno 已提交
68

69 70 71 72
	addToRecentlyOpen(paths: { path: string, isFile?: boolean }[]): TPromise<void> {
		return this.windowsService.addToRecentlyOpen(paths);
	}

B
Benjamin Pasero 已提交
73 74 75 76
	removeFromRecentlyOpen(paths: string[]): TPromise<void> {
		return this.windowsService.removeFromRecentlyOpen(paths);
	}

J
Joao Moreno 已提交
77 78 79
	getRecentlyOpen(): TPromise<{ files: string[]; folders: string[]; }> {
		return this.windowsService.getRecentlyOpen(this.windowId);
	}
J
Joao Moreno 已提交
80 81 82 83

	focusWindow(): TPromise<void> {
		return this.windowsService.focusWindow(this.windowId);
	}
J
Joao Moreno 已提交
84

85 86 87 88
	isFocused(): TPromise<boolean> {
		return this.windowsService.isFocused(this.windowId);
	}

89 90 91 92 93 94 95 96 97 98 99 100
	isMaximized(): TPromise<boolean> {
		return this.windowsService.isMaximized(this.windowId);
	}

	maximizeWindow(): TPromise<void> {
		return this.windowsService.maximizeWindow(this.windowId);
	}

	unmaximizeWindow(): TPromise<void> {
		return this.windowsService.unmaximizeWindow(this.windowId);
	}

101 102 103 104
	onWindowTitleDoubleClick(): TPromise<void> {
		return this.windowsService.onWindowTitleDoubleClick(this.windowId);
	}

J
Joao Moreno 已提交
105 106 107
	setDocumentEdited(flag: boolean): TPromise<void> {
		return this.windowsService.setDocumentEdited(this.windowId, flag);
	}
J
Joao Moreno 已提交
108

109
}