File tree Expand file tree Collapse file tree 4 files changed +30
-22
lines changed
arduino-ide-extension/src
electron-browser/theia/core Expand file tree Collapse file tree 4 files changed +30
-22
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import { BoardsDataStore } from './boards-data-store';
1313import { MainMenuManager } from '../../common/main-menu-manager' ;
1414import { ArduinoMenus , unregisterSubmenu } from '../menu/arduino-menus' ;
1515import { nls } from '@theia/core/lib/common' ;
16+ import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state' ;
1617
1718@injectable ( )
1819export class BoardsDataMenuUpdater implements FrontendApplicationContribution {
@@ -31,11 +32,20 @@ export class BoardsDataMenuUpdater implements FrontendApplicationContribution {
3132 @inject ( BoardsServiceProvider )
3233 protected readonly boardsServiceClient : BoardsServiceProvider ;
3334
35+ @inject ( FrontendApplicationStateService )
36+ private readonly appStateService : FrontendApplicationStateService ;
37+
3438 protected readonly queue = new PQueue ( { autoStart : true , concurrency : 1 } ) ;
3539 protected readonly toDisposeOnBoardChange = new DisposableCollection ( ) ;
3640
3741 async onStart ( ) : Promise < void > {
38- this . updateMenuActions ( this . boardsServiceClient . boardsConfig . selectedBoard ) ;
42+ this . appStateService
43+ . reachedState ( 'ready' )
44+ . then ( ( ) =>
45+ this . updateMenuActions (
46+ this . boardsServiceClient . boardsConfig . selectedBoard
47+ )
48+ ) ;
3949 this . boardsDataStore . onChanged ( ( ) =>
4050 this . updateMenuActions (
4151 this . boardsServiceClient . boardsConfig . selectedBoard
Original file line number Diff line number Diff line change @@ -101,16 +101,14 @@ PID: ${PID}`;
101101 }
102102
103103 override onStart ( ) : void {
104- this . notificationCenter . onPlatformInstalled ( this . updateMenus . bind ( this ) ) ;
105- this . notificationCenter . onPlatformUninstalled ( this . updateMenus . bind ( this ) ) ;
106- this . boardsServiceProvider . onBoardsConfigChanged (
107- this . updateMenus . bind ( this )
104+ this . notificationCenter . onPlatformInstalled ( ( ) => this . updateMenus ( ) ) ;
105+ this . notificationCenter . onPlatformUninstalled ( ( ) => this . updateMenus ( ) ) ;
106+ this . boardsServiceProvider . onBoardsConfigChanged ( ( ) => this . updateMenus ( ) ) ;
107+ this . boardsServiceProvider . onAvailableBoardsChanged ( ( ) =>
108+ this . updateMenus ( )
108109 ) ;
109- this . boardsServiceProvider . onAvailableBoardsChanged (
110- this . updateMenus . bind ( this )
111- ) ;
112- this . boardsServiceProvider . onAvailablePortsChanged (
113- this . updateMenus . bind ( this )
110+ this . boardsServiceProvider . onAvailablePortsChanged ( ( ) =>
111+ this . updateMenus ( )
114112 ) ;
115113 }
116114
Original file line number Diff line number Diff line change @@ -18,16 +18,16 @@ export class ElectronMenuContribution
1818 @inject ( FrontendApplicationStateService )
1919 private readonly appStateService : FrontendApplicationStateService ;
2020
21- private appReady = false ;
22- private updateWhenReady = false ;
21+ // private appReady = false;
22+ // private updateWhenReady = false;
2323
2424 override onStart ( app : FrontendApplication ) : void {
2525 super . onStart ( app ) ;
2626 this . appStateService . reachedState ( 'ready' ) . then ( ( ) => {
27- this . appReady = true ;
28- if ( this . updateWhenReady ) {
29- this . update ( ) ;
30- }
27+ // this.appReady = true;
28+ // if (this.updateWhenReady) {
29+ // this.update();
30+ // }
3131 } ) ;
3232 }
3333
@@ -37,11 +37,11 @@ export class ElectronMenuContribution
3737 }
3838
3939 update ( ) : void {
40- if ( this . appReady ) {
41- ( this as any ) . setMenu ( ) ;
42- } else {
43- this . updateWhenReady = true ;
44- }
40+ ( this as any ) . setMenu ( ) ;
41+ // if (this.appReady) {
42+ // } else {
43+ // this.updateWhenReady = true;
44+ // }
4545 }
4646
4747 override registerCommands ( registry : CommandRegistry ) : void {
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export class ArduinoDaemonImpl
4141 // Backend application lifecycle.
4242
4343 onStart ( ) : void {
44- this . startDaemon ( ) ;
44+ this . startDaemon ( ) ; // no await
4545 }
4646
4747 // Daemon API
You can’t perform that action at this time.
0 commit comments