partService.ts 2.3 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4 5 6 7
/*---------------------------------------------------------------------------------------------
 *  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';
B
Benjamin Pasero 已提交
8
import {createDecorator, ServiceIdentifier} from 'vs/platform/instantiation/common/instantiation';
E
Erich Gamma 已提交
9 10 11 12

export enum Parts {
	ACTIVITYBAR_PART,
	SIDEBAR_PART,
I
isidor 已提交
13
	PANEL_PART,
E
Erich Gamma 已提交
14 15 16 17 18 19 20 21 22
	EDITOR_PART,
	STATUSBAR_PART
}

export enum Position {
	LEFT,
	RIGHT
}

B
Benjamin Pasero 已提交
23
export const IPartService = createDecorator<IPartService>('partService');
E
Erich Gamma 已提交
24 25

export interface IPartService {
26
	_serviceBrand : ServiceIdentifier<any>;
E
Erich Gamma 已提交
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43

	/**
	 * Asks the part service to layout all parts.
	 */
	layout(): void;

	/**
	 * Asks the part service to if all parts have been created.
	 */
	isCreated(): boolean;

	/**
	 * Promise is complete when all parts have been created.
	 */
	joinCreation(): TPromise<boolean>;

	/**
P
Pascal Borreli 已提交
44
	 * Returns whether the given part has the keyboard focus or not.
E
Erich Gamma 已提交
45 46 47 48 49 50 51 52
	 */
	hasFocus(part: Parts): boolean;

	/**
	 * Returns iff the part is visible.
	 */
	isVisible(part: Parts): boolean;

53 54 55 56 57 58 59 60 61 62
	/**
	 * Checks if the statusbar is currently hidden or not
	 */
	isStatusBarHidden(): boolean;

	/**
	 * Set statusbar hidden or not
	 */
	setStatusBarHidden(hidden: boolean): void;

E
Erich Gamma 已提交
63 64 65 66 67 68 69 70 71 72
	/**
	 * Checks if the sidebar is currently hidden or not
	 */
	isSideBarHidden(): boolean;

	/**
	 * Set sidebar hidden or not
	 */
	setSideBarHidden(hidden: boolean): void;

I
isidor 已提交
73 74 75
	/**
	 * Checks if the panel part is currently hidden or not
	 */
I
isidor 已提交
76
	isPanelHidden(): boolean;
I
isidor 已提交
77 78 79 80

	/**
	 * Set panel part hidden or not
	 */
I
isidor 已提交
81
	setPanelHidden(hidden: boolean): void;
I
isidor 已提交
82

E
Erich Gamma 已提交
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
	/**
	 * Gets the current side bar position. Note that the sidebar can be hidden too.
	 */
	getSideBarPosition(): Position;

	/**
	 * Sets the side bar position. If the side bar is hidden, the side bar will
	 * also be made visible.
	 */
	setSideBarPosition(position: Position): void;

	/**
	 * Adds a class to the workbench part.
	 */
	addClass(clazz: string): void;

	/**
	 * Removes a class from the workbench part.
	 */
	removeClass(clazz: string): void;
103 104 105 106 107

	/**
	 * Returns the identifier of the element that contains the workbench.
	 */
	getWorkbenchElementId(): string;
E
Erich Gamma 已提交
108
}