mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-06-20 11:06:32 +00:00

* prevent deselecting a board from the board selctor * orrectly update board selector when baord config changes
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { CommandRegistry } from '@theia/core';
|
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
import { BoardsConfigDialog } from '../boards/boards-config-dialog';
|
|
import { BoardsServiceProvider } from '../boards/boards-service-provider';
|
|
import { Contribution, Command } from './contribution';
|
|
|
|
@injectable()
|
|
export class OpenBoardsConfig extends Contribution {
|
|
@inject(BoardsServiceProvider)
|
|
private readonly boardsServiceProvider: BoardsServiceProvider;
|
|
|
|
@inject(BoardsConfigDialog)
|
|
private readonly boardsConfigDialog: BoardsConfigDialog;
|
|
|
|
override registerCommands(registry: CommandRegistry): void {
|
|
registry.registerCommand(OpenBoardsConfig.Commands.OPEN_DIALOG, {
|
|
execute: async (query?: string | undefined) => {
|
|
const boardsConfig = await this.boardsConfigDialog.open(query);
|
|
if (boardsConfig) {
|
|
return (this.boardsServiceProvider.boardsConfig = boardsConfig);
|
|
}
|
|
},
|
|
});
|
|
}
|
|
}
|
|
export namespace OpenBoardsConfig {
|
|
export namespace Commands {
|
|
export const OPEN_DIALOG: Command = {
|
|
id: 'arduino-open-boards-dialog',
|
|
};
|
|
}
|
|
}
|