-
Notifications
You must be signed in to change notification settings - Fork 29.4k
/
loadedScriptsView.ts
104 lines (83 loc) · 4.01 KB
/
loadedScriptsView.ts
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { TreeViewsViewletPanel, IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
import { TPromise } from 'vs/base/common/winjs.base';
import * as dom from 'vs/base/browser/dom';
import { IViewletPanelOptions } from 'vs/workbench/browser/parts/views/panelViewlet';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { WorkbenchTree } from 'vs/platform/list/browser/listService';
import { renderViewTree, twistiePixels } from 'vs/workbench/parts/debug/browser/baseDebugView';
import { IAccessibilityProvider, ITree, IRenderer, IDataSource } from 'vs/base/parts/tree/browser/tree';
export class LoadedScriptsView extends TreeViewsViewletPanel {
private treeContainer: HTMLElement;
constructor(
options: IViewletViewOptions,
@IContextMenuService contextMenuService: IContextMenuService,
@IKeybindingService keybindingService: IKeybindingService,
@IInstantiationService private instantiationService: IInstantiationService,
@IConfigurationService configurationService: IConfigurationService,
) {
super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: nls.localize('loadedScriptsSection', "Loaded Scripts Section") }, keybindingService, contextMenuService, configurationService);
}
protected renderBody(container: HTMLElement): void {
dom.addClass(container, 'debug-loaded-scripts');
this.treeContainer = renderViewTree(container);
this.tree = this.instantiationService.createInstance(WorkbenchTree, this.treeContainer, {
dataSource: new LoadedScriptsDataSource(),
renderer: this.instantiationService.createInstance(LoadedScriptsRenderer),
accessibilityProvider: new LoadedSciptsAccessibilityProvider(),
}, {
ariaLabel: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'loadedScriptsAriaLabel' }, "Debug Loaded Scripts"),
twistiePixels
});
}
layoutBody(size: number): void {
if (this.treeContainer) {
this.treeContainer.style.height = size + 'px';
}
super.layoutBody(size);
}
}
// A good example of data source, renderers, action providers and accessibilty providers can be found in the callStackView.ts
class LoadedScriptsDataSource implements IDataSource {
getId(tree: ITree, element: any): string {
throw new Error('Method not implemented.');
}
hasChildren(tree: ITree, element: any): boolean {
throw new Error('Method not implemented.');
}
getChildren(tree: ITree, element: any): TPromise<any> {
throw new Error('Method not implemented.');
}
getParent(tree: ITree, element: any): TPromise<any> {
throw new Error('Method not implemented.');
}
}
class LoadedScriptsRenderer implements IRenderer {
getHeight(tree: ITree, element: any): number {
throw new Error('Method not implemented.');
}
getTemplateId(tree: ITree, element: any): string {
throw new Error('Method not implemented.');
}
renderTemplate(tree: ITree, templateId: string, container: HTMLElement) {
throw new Error('Method not implemented.');
}
renderElement(tree: ITree, element: any, templateId: string, templateData: any): void {
throw new Error('Method not implemented.');
}
disposeTemplate(tree: ITree, templateId: string, templateData: any): void {
throw new Error('Method not implemented.');
}
}
class LoadedSciptsAccessibilityProvider implements IAccessibilityProvider {
public getAriaLabel(tree: ITree, element: any): string {
return nls.localize('implement me', "implement me");
}
}