File tree 4 files changed +61
-0
lines changed
4 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { container , inject , injectable } from 'tsyringe' ;
2
+
3
+ export interface IPanelItem {
4
+ id : string ;
5
+ title ?: string ;
6
+ render ?: ( ) => React . ReactNode ;
7
+ }
8
+
9
+ export enum PanelEvent {
10
+ onClick = 'panel.onClick' ,
11
+ }
12
+
13
+ export interface IPanel {
14
+ current : string ;
15
+ panes ?: IPanelItem [ ] ;
16
+ }
17
+
18
+ @injectable ( )
19
+ export class PanelModel implements IPanel {
20
+ public current : string ;
21
+ public panes : IPanelItem [ ] ;
22
+
23
+ constructor (
24
+ @inject ( 'PanelItems' ) panes : IPanelItem [ ] = [ ] ,
25
+ @inject ( 'CurrentPanel' ) current : string = ''
26
+ ) {
27
+ this . panes = panes ;
28
+ this . current = current ;
29
+ }
30
+ }
31
+
32
+ container . register ( 'PanelItems' , { useValue : [ ] } ) ;
33
+ container . register ( 'CurrentPanel' , { useValue : '' } ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { container } from 'tsyringe';
4
4
export * from './extensionService' ;
5
5
export * from './theme/colorThemeService' ;
6
6
export * from './workbench' ;
7
+ export * from './settingsService' ;
7
8
8
9
import {
9
10
ColorThemeService ,
@@ -23,7 +24,10 @@ import {
23
24
StatusBarService ,
24
25
EditorService ,
25
26
IEditorService ,
27
+ IPanelService ,
28
+ PanelService ,
26
29
} from './workbench' ;
30
+ import { ISettingsService , SettingsService } from './settingsService' ;
27
31
28
32
/**
29
33
* The Services of Workbench
@@ -37,6 +41,7 @@ const sidebarService = container.resolve<ISidebarService>(SidebarService);
37
41
const menuBarService = container . resolve < IMenuBarService > ( MenuBarService ) ;
38
42
const editorService = container . resolve < IEditorService > ( EditorService ) ;
39
43
const statusBarService = container . resolve < IStatusBarService > ( StatusBarService ) ;
44
+ const panelService = container . resolve < IPanelService > ( PanelService ) ;
40
45
41
46
/**
42
47
* The ColorTheme service,
@@ -51,13 +56,20 @@ const colorThemeService = container.resolve<IColorThemeService>(
51
56
*/
52
57
const extensionService = container . resolve < IExtensionService > ( ExtensionService ) ;
53
58
59
+ /**
60
+ * Settings service
61
+ */
62
+ const settingsService = container . resolve < ISettingsService > ( SettingsService ) ;
63
+
54
64
export {
55
65
activityBarService ,
56
66
explorerService ,
57
67
sidebarService ,
58
68
menuBarService ,
59
69
statusBarService ,
70
+ panelService ,
60
71
editorService ,
61
72
extensionService ,
62
73
colorThemeService ,
74
+ settingsService ,
63
75
} ;
Original file line number Diff line number Diff line change @@ -4,3 +4,4 @@ export * from './sidebarService';
4
4
export * from './editorService' ;
5
5
export * from './statusBarService' ;
6
6
export * from './explorerService' ;
7
+ export * from './panelService' ;
Original file line number Diff line number Diff line change
1
+ import { IPanel , PanelModel } from 'mo/model/workbench/panel' ;
2
+ import { Component } from 'mo/react' ;
3
+ import { singleton , container } from 'tsyringe' ;
4
+
5
+ export interface IPanelService extends Component < IPanel > { }
6
+
7
+ @singleton ( )
8
+ export class PanelService extends Component < IPanel > implements IPanelService {
9
+ protected state : IPanel ;
10
+
11
+ constructor ( ) {
12
+ super ( ) ;
13
+ this . state = container . resolve ( PanelModel ) ;
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments