forked from irinazheltisheva/vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewContext.ts
More file actions
60 lines (48 loc) · 1.81 KB
/
Copy pathviewContext.ts
File metadata and controls
60 lines (48 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IConfiguration } from 'vs/editor/common/editorCommon';
import { ViewEventHandler } from 'vs/editor/common/viewModel/viewEventHandler';
import { IViewLayout, IViewModel } from 'vs/editor/common/viewModel/viewModel';
import { IColorTheme } from 'vs/platform/theme/common/themeService';
import { ColorIdentifier } from 'vs/platform/theme/common/colorRegistry';
import { Color } from 'vs/base/common/color';
import { ColorScheme } from 'vs/platform/theme/common/theme';
export class EditorTheme {
private _theme: IColorTheme;
public get type(): ColorScheme {
return this._theme.type;
}
constructor(theme: IColorTheme) {
this._theme = theme;
}
public update(theme: IColorTheme): void {
this._theme = theme;
}
public getColor(color: ColorIdentifier): Color | undefined {
return this._theme.getColor(color);
}
}
export class ViewContext {
public readonly configuration: IConfiguration;
public readonly model: IViewModel;
public readonly viewLayout: IViewLayout;
public readonly theme: EditorTheme;
constructor(
configuration: IConfiguration,
theme: IColorTheme,
model: IViewModel
) {
this.configuration = configuration;
this.theme = new EditorTheme(theme);
this.model = model;
this.viewLayout = model.viewLayout;
}
public addEventHandler(eventHandler: ViewEventHandler): void {
this.model.addViewEventHandler(eventHandler);
}
public removeEventHandler(eventHandler: ViewEventHandler): void {
this.model.removeViewEventHandler(eventHandler);
}
}