File tree 3 files changed +30
-3
lines changed
arduino-ide-extension/src
3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -301,7 +301,10 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
301
301
} ) ;
302
302
303
303
registry . registerCommand ( ArduinoCommands . TOGGLE_COMPILE_FOR_DEBUG , {
304
- execute : ( ) => this . editorMode . toggleCompileForDebug ( ) ,
304
+ execute : ( ) => {
305
+ this . editorMode . toggleCompileForDebug ( ) ;
306
+ this . editorMode . menuContentChanged . fire ( ) ;
307
+ } ,
305
308
isToggled : ( ) => this . editorMode . compileForDebug
306
309
} ) ;
307
310
@@ -416,7 +419,10 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
416
419
} ) ;
417
420
418
421
registry . registerCommand ( ArduinoCommands . TOGGLE_ADVANCED_MODE , {
419
- execute : ( ) => this . editorMode . toggleProMode ( ) ,
422
+ execute : ( ) => {
423
+ this . editorMode . toggleProMode ( ) ;
424
+ this . editorMode . menuContentChanged . fire ( ) ;
425
+ } ,
420
426
isVisible : widget => ArduinoToolbar . is ( widget ) && widget . side === 'right' ,
421
427
isToggled : ( ) => this . editorMode . proMode
422
428
} ) ;
Original file line number Diff line number Diff line change 1
1
import { injectable } from 'inversify' ;
2
+ import { Emitter } from '@theia/core/lib/common/event' ;
2
3
import { ApplicationShell , FrontendApplicationContribution , FrontendApplication } from '@theia/core/lib/browser' ;
3
4
import { ArduinoShellLayoutRestorer } from './shell/arduino-shell-layout-restorer' ;
4
5
import { OutputWidget } from '@theia/output/lib/browser/output-widget' ;
@@ -7,6 +8,8 @@ import { EditorWidget } from '@theia/editor/lib/browser';
7
8
@injectable ( )
8
9
export class EditorMode implements FrontendApplicationContribution {
9
10
11
+ readonly menuContentChanged = new Emitter < void > ( ) ;
12
+
10
13
protected app : FrontendApplication ;
11
14
12
15
onStart ( app : FrontendApplication ) : void {
Original file line number Diff line number Diff line change 1
- import { injectable } from 'inversify' ;
1
+ import * as electron from 'electron' ;
2
+ import { injectable , inject , postConstruct } from 'inversify' ;
3
+ import { isOSX } from '@theia/core/lib/common/os' ;
2
4
import { ElectronMenuContribution } from '@theia/core/lib/electron-browser/menu/electron-menu-contribution' ;
5
+ import { EditorMode } from '../browser/editor-mode' ;
3
6
4
7
@injectable ( )
5
8
export class ElectronArduinoMenuContribution extends ElectronMenuContribution {
6
9
10
+ @inject ( EditorMode )
11
+ protected readonly editorMode : EditorMode ;
12
+
13
+ @postConstruct ( )
14
+ protected init ( ) : void {
15
+ this . editorMode . menuContentChanged . event ( ( ) => {
16
+ const createdMenuBar = this . factory . createMenuBar ( ) ;
17
+ if ( isOSX ) {
18
+ electron . remote . Menu . setApplicationMenu ( createdMenuBar ) ;
19
+ } else {
20
+ electron . remote . getCurrentWindow ( ) . setMenu ( createdMenuBar ) ;
21
+ }
22
+ } ) ;
23
+ }
24
+
7
25
protected hideTopPanel ( ) : void {
8
26
// NOOP
9
27
// We reuse the `div` for the Arduino toolbar.
You can’t perform that action at this time.
0 commit comments