mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-08 11:56:36 +00:00
fix: refresh the user-fields at app startup
Ref: arduino/arduino-ide#2165 Closes arduino/arduino-ide#2230 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
parent
9f48296d4d
commit
7f660d76a8
@ -1,10 +1,10 @@
|
|||||||
|
import { nls } from '@theia/core/lib/common/nls';
|
||||||
import { inject, injectable } from '@theia/core/shared/inversify';
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
||||||
import { nls } from '@theia/core/lib/common';
|
|
||||||
import { BoardUserField, CoreError } from '../../common/protocol';
|
import { BoardUserField, CoreError } from '../../common/protocol';
|
||||||
import { BoardsServiceProvider } from '../boards/boards-service-provider';
|
import { BoardsServiceProvider } from '../boards/boards-service-provider';
|
||||||
import { UserFieldsDialog } from '../dialogs/user-fields/user-fields-dialog';
|
import { UserFieldsDialog } from '../dialogs/user-fields/user-fields-dialog';
|
||||||
import { ArduinoMenus } from '../menu/arduino-menus';
|
import { ArduinoMenus } from '../menu/arduino-menus';
|
||||||
import { MenuModelRegistry, Contribution } from './contribution';
|
import { Contribution, MenuModelRegistry } from './contribution';
|
||||||
import { UploadSketch } from './upload-sketch';
|
import { UploadSketch } from './upload-sketch';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
@ -21,12 +21,11 @@ export class UserFields extends Contribution {
|
|||||||
|
|
||||||
protected override init(): void {
|
protected override init(): void {
|
||||||
super.init();
|
super.init();
|
||||||
this.boardsServiceProvider.onBoardsConfigDidChange(async () => {
|
this.boardsServiceProvider.onBoardsConfigDidChange(() => this.refresh());
|
||||||
const userFields =
|
}
|
||||||
await this.boardsServiceProvider.selectedBoardUserFields();
|
|
||||||
this.boardRequiresUserFields = userFields.length > 0;
|
override onReady(): void {
|
||||||
this.menuManager.update();
|
this.boardsServiceProvider.ready.then(() => this.refresh());
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override registerMenus(registry: MenuModelRegistry): void {
|
override registerMenus(registry: MenuModelRegistry): void {
|
||||||
@ -37,6 +36,13 @@ export class UserFields extends Contribution {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async refresh(): Promise<void> {
|
||||||
|
const userFields =
|
||||||
|
await this.boardsServiceProvider.selectedBoardUserFields();
|
||||||
|
this.boardRequiresUserFields = userFields.length > 0;
|
||||||
|
this.menuManager.update();
|
||||||
|
}
|
||||||
|
|
||||||
private selectedFqbnAddress(): string | undefined {
|
private selectedFqbnAddress(): string | undefined {
|
||||||
const { boardsConfig } = this.boardsServiceProvider;
|
const { boardsConfig } = this.boardsServiceProvider;
|
||||||
const fqbn = boardsConfig.selectedBoard?.fqbn;
|
const fqbn = boardsConfig.selectedBoard?.fqbn;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user