-
-
Notifications
You must be signed in to change notification settings - Fork 435
/
Copy pathsketchbook-tree-container.ts
42 lines (35 loc) · 1.23 KB
/
sketchbook-tree-container.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
import { interfaces, Container } from '@theia/core/shared/inversify';
import {
CompressionToggle,
createTreeContainer,
Tree,
TreeCompressionService,
TreeImpl,
TreeModel,
TreeModelImpl,
TreeWidget,
} from '@theia/core/lib/browser/tree';
import { SketchbookTree } from './sketchbook-tree';
import { SketchbookTreeModel } from './sketchbook-tree-model';
import { SketchbookTreeWidget } from './sketchbook-tree-widget';
export function createSketchbookTreeContainer(
parent: interfaces.Container
): Container {
const child = createTreeContainer(parent);
child.unbind(TreeImpl);
child.bind(SketchbookTree).toSelf();
child.rebind(Tree).toService(SketchbookTree);
child.unbind(TreeModelImpl);
child.bind(SketchbookTreeModel).toSelf();
child.rebind(TreeModel).toService(SketchbookTreeModel);
child.bind(SketchbookTreeWidget).toSelf();
child.rebind(TreeWidget).toService(SketchbookTreeWidget);
child.bind(CompressionToggle).toConstantValue({ compress: false });
child.bind(TreeCompressionService).toSelf().inSingletonScope();
return child;
}
export function createSketchbookTreeWidget(
parent: interfaces.Container
): SketchbookTreeWidget {
return createSketchbookTreeContainer(parent).get(SketchbookTreeWidget);
}