windowService.ts 3.0 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;
	}

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

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

33 34
	openFolderPicker(forceNewWindow?: boolean, data?: ITelemetryData): TPromise<void> {
		return this.windowsService.openFolderPicker(this.windowId, forceNewWindow, data);
J
Joao Moreno 已提交
35
	}
36 37 38 39

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

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

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

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

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

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

61 62 63 64
	addToRecentlyOpen(paths: { path: string, isFile?: boolean }[]): TPromise<void> {
		return this.windowsService.addToRecentlyOpen(paths);
	}

B
Benjamin Pasero 已提交
65 66 67 68
	removeFromRecentlyOpen(paths: string[]): TPromise<void> {
		return this.windowsService.removeFromRecentlyOpen(paths);
	}

J
Joao Moreno 已提交
69 70 71
	getRecentlyOpen(): TPromise<{ files: string[]; folders: string[]; }> {
		return this.windowsService.getRecentlyOpen(this.windowId);
	}
J
Joao Moreno 已提交
72 73 74 75

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

77 78 79 80
	isFocused(): TPromise<boolean> {
		return this.windowsService.isFocused(this.windowId);
	}

81 82 83 84 85 86 87 88 89 90 91 92
	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);
	}

J
Joao Moreno 已提交
93 94 95
	setDocumentEdited(flag: boolean): TPromise<void> {
		return this.windowsService.setDocumentEdited(this.windowId, flag);
	}
J
Joao Moreno 已提交
96

97
}