@@ -26,6 +26,9 @@ import { NOTEBOOK_CELL_EXECUTION_STATE, NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_CEL
26
26
export class RunToolbar extends CellPart {
27
27
private toolbar ! : WorkbenchToolBar ;
28
28
29
+ private primaryMenu : IMenu ;
30
+ private secondaryMenu : IMenu ;
31
+
29
32
constructor (
30
33
readonly notebookEditor : INotebookEditorDelegate ,
31
34
readonly contextKeyService : IContextKeyService ,
@@ -38,18 +41,17 @@ export class RunToolbar extends CellPart {
38
41
) {
39
42
super ( ) ;
40
43
41
- const menu = this . _register ( menuService . createMenu ( this . notebookEditor . creationOptions . menuIds . cellExecutePrimary ! , contextKeyService ) ) ;
42
- const secondaryMenu = this . _register ( menuService . createMenu ( this . notebookEditor . creationOptions . menuIds . cellExecuteToolbar , contextKeyService ) ) ;
43
- // TODO@roblourens what does secondaryMenu actually do? where/when is it rendered?
44
+ this . primaryMenu = this . _register ( menuService . createMenu ( this . notebookEditor . creationOptions . menuIds . cellExecutePrimary ! , contextKeyService ) ) ;
45
+ this . secondaryMenu = this . _register ( menuService . createMenu ( this . notebookEditor . creationOptions . menuIds . cellExecuteToolbar , contextKeyService ) ) ;
44
46
this . createRunCellToolbar ( runButtonContainer , cellContainer , contextKeyService ) ;
45
47
const updateActions = ( ) => {
46
- const actions = this . getCellToolbarActions ( menu ) ;
48
+ const actions = this . getCellToolbarActions ( this . primaryMenu ) ;
47
49
const primary = actions . primary [ 0 ] ; // Only allow one primary action
48
50
this . toolbar . setActions ( primary ? [ primary ] : [ ] ) ;
49
51
} ;
50
52
updateActions ( ) ;
51
- this . _register ( menu . onDidChange ( updateActions ) ) ;
52
- this . _register ( secondaryMenu . onDidChange ( updateActions ) ) ;
53
+ this . _register ( this . primaryMenu . onDidChange ( updateActions ) ) ;
54
+ this . _register ( this . secondaryMenu . onDidChange ( updateActions ) ) ;
53
55
this . _register ( this . notebookEditor . notebookOptions . onDidChangeOptions ( updateActions ) ) ;
54
56
}
55
57
@@ -86,14 +88,12 @@ export class RunToolbar extends CellPart {
86
88
actionViewItemProvider : _action => {
87
89
actionViewItemDisposables . clear ( ) ;
88
90
89
- const primaryMenu = actionViewItemDisposables . add ( this . menuService . createMenu ( this . notebookEditor . creationOptions . menuIds . cellExecutePrimary ! , contextKeyService ) ) ;
90
- const primary = this . getCellToolbarActions ( primaryMenu ) . primary [ 0 ] ;
91
+ const primary = this . getCellToolbarActions ( this . primaryMenu ) . primary [ 0 ] ;
91
92
if ( ! ( primary instanceof MenuItemAction ) ) {
92
93
return undefined ;
93
94
}
94
95
95
- const menu = actionViewItemDisposables . add ( this . menuService . createMenu ( this . notebookEditor . creationOptions . menuIds . cellExecuteToolbar , contextKeyService ) ) ;
96
- const secondary = this . getCellToolbarActions ( menu ) . secondary ;
96
+ const secondary = this . getCellToolbarActions ( this . secondaryMenu ) . secondary ;
97
97
if ( ! secondary . length ) {
98
98
return undefined ;
99
99
}
0 commit comments