@@ -11,40 +11,36 @@ import {
11
11
} from 'mo/model/workbench/menuBar' ;
12
12
import { Controller } from 'mo/react/controller' ;
13
13
import {
14
- ActivityBarService ,
15
14
EditorService ,
16
- IActivityBarService ,
17
15
IEditorService ,
18
16
IMenuBarService ,
19
- ISidebarService ,
20
- IStatusBarService ,
17
+ ILayoutService ,
21
18
MenuBarService ,
22
- SidebarService ,
23
- StatusBarService ,
19
+ LayoutService ,
24
20
} from 'mo/services' ;
25
21
26
22
export interface IMenuBarController {
27
23
onSelect ?: ( key : string , item ?: IActivityBarItem ) => void ;
28
24
onClick : ( event : React . MouseEvent < any , any > , item : IMenuBarItem ) => void ;
25
+ updateStatusBar ?: ( ) => void ;
26
+ updateMenuBar ?: ( ) => void ;
27
+ updateActivityBar ?: ( ) => void ;
28
+ updateSideBar ?: ( ) => void ;
29
29
}
30
30
31
31
@singleton ( )
32
32
export class MenuBarController
33
33
extends Controller
34
34
implements IMenuBarController {
35
- private readonly activityBarService : IActivityBarService ;
36
35
private readonly editorService : IEditorService ;
37
36
private readonly menuBarService : IMenuBarService ;
38
- private readonly statusBarService : IStatusBarService ;
39
- private readonly sidebarService : ISidebarService ;
37
+ private readonly layoutService : ILayoutService ;
40
38
41
39
constructor ( ) {
42
40
super ( ) ;
43
- this . activityBarService = container . resolve ( ActivityBarService ) ;
44
41
this . editorService = container . resolve ( EditorService ) ;
45
42
this . menuBarService = container . resolve ( MenuBarService ) ;
46
- this . statusBarService = container . resolve ( StatusBarService ) ;
47
- this . sidebarService = container . resolve ( SidebarService ) ;
43
+ this . layoutService = container . resolve ( LayoutService ) ;
48
44
}
49
45
50
46
public readonly onClick = ( event : React . MouseEvent , item : IMenuBarItem ) => {
@@ -80,32 +76,40 @@ export class MenuBarController
80
76
} ;
81
77
82
78
public updateActivityBar = ( ) => {
83
- this . activityBarService . showHide ( ) ;
84
- const { hidden } = this . activityBarService . getState ( ) ;
79
+ this . layoutService . setActivityBarHidden ( ) ;
80
+ const {
81
+ activityBar : { hidden } ,
82
+ } = this . layoutService . getState ( ) ;
85
83
this . menuBarService . update ( MENU_VIEW_ACTIVITYBAR , {
86
84
icon : hidden ? '' : 'check' ,
87
85
} ) ;
88
86
} ;
89
87
90
88
public updateMenuBar = ( ) => {
91
- this . menuBarService . showHide ( ) ;
92
- const { hidden } = this . menuBarService . getState ( ) ;
89
+ this . layoutService . setMenuBarHidden ( ) ;
90
+ const {
91
+ menuBar : { hidden } ,
92
+ } = this . layoutService . getState ( ) ;
93
93
this . menuBarService . update ( MENU_VIEW_MENUBAR , {
94
94
icon : hidden ? '' : 'check' ,
95
95
} ) ;
96
96
} ;
97
97
98
98
public updateStatusBar = ( ) => {
99
- this . statusBarService . showHide ( ) ;
100
- const { hidden } = this . statusBarService . getState ( ) ;
99
+ this . layoutService . setStatusBarHidden ( ) ;
100
+ const {
101
+ statusBar : { hidden } ,
102
+ } = this . layoutService . getState ( ) ;
101
103
this . menuBarService . update ( MENU_VIEW_STATUSBAR , {
102
104
icon : hidden ? '' : 'check' ,
103
105
} ) ;
104
106
} ;
105
107
106
108
public updateSideBar = ( ) => {
107
- this . sidebarService . showHide ( ) ;
108
- const { hidden } = this . sidebarService . getState ( ) ;
109
+ this . layoutService . setSideBarHidden ( ) ;
110
+ const {
111
+ sideBar : { hidden } ,
112
+ } = this . layoutService . getState ( ) ;
109
113
this . menuBarService . update ( MENU_VIEW_SIDEBAR , {
110
114
icon : hidden ? '' : 'check' ,
111
115
} ) ;
0 commit comments