mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-10-18 15:48:31 +00:00

* Update Theia to 1.19.0 * update CLI to 0.20.0-rc3 * Add language selector to settings * updated language server and vscode-arduino-tools * update Language Server flags * get cli port from config * force native menu on windows * pinned Language Server to rc2 * fix search icon * update CLI version
85 lines
2.2 KiB
TypeScript
85 lines
2.2 KiB
TypeScript
import { inject, injectable, postConstruct } from 'inversify';
|
|
import {
|
|
BoardsPackage,
|
|
BoardsService,
|
|
} from '../../common/protocol/boards-service';
|
|
import { ListWidget } from '../widgets/component-list/list-widget';
|
|
import { ListItemRenderer } from '../widgets/component-list/list-item-renderer';
|
|
import { nls } from '@theia/core/lib/common';
|
|
|
|
@injectable()
|
|
export class BoardsListWidget extends ListWidget<BoardsPackage> {
|
|
static WIDGET_ID = 'boards-list-widget';
|
|
static WIDGET_LABEL = nls.localize('arduino/boardsManager', 'Boards Manager');
|
|
|
|
constructor(
|
|
@inject(BoardsService) protected service: BoardsService,
|
|
@inject(ListItemRenderer)
|
|
protected itemRenderer: ListItemRenderer<BoardsPackage>
|
|
) {
|
|
super({
|
|
id: BoardsListWidget.WIDGET_ID,
|
|
label: BoardsListWidget.WIDGET_LABEL,
|
|
iconClass: 'fa fa-arduino-boards',
|
|
searchable: service,
|
|
installable: service,
|
|
itemLabel: (item: BoardsPackage) => item.name,
|
|
itemDeprecated: (item: BoardsPackage) => item.deprecated,
|
|
itemRenderer,
|
|
});
|
|
}
|
|
|
|
@postConstruct()
|
|
protected init(): void {
|
|
super.init();
|
|
this.toDispose.pushAll([
|
|
this.notificationCenter.onPlatformInstalled(() =>
|
|
this.refresh(undefined)
|
|
),
|
|
this.notificationCenter.onPlatformUninstalled(() =>
|
|
this.refresh(undefined)
|
|
),
|
|
]);
|
|
}
|
|
|
|
protected async install({
|
|
item,
|
|
progressId,
|
|
version,
|
|
}: {
|
|
item: BoardsPackage;
|
|
progressId: string;
|
|
version: string;
|
|
}): Promise<void> {
|
|
await super.install({ item, progressId, version });
|
|
this.messageService.info(
|
|
nls.localize(
|
|
'arduino/board/succesfullyInstalledPlatform',
|
|
'Successfully installed platform {0}:{1}',
|
|
item.name,
|
|
version
|
|
),
|
|
{ timeout: 3000 }
|
|
);
|
|
}
|
|
|
|
protected async uninstall({
|
|
item,
|
|
progressId,
|
|
}: {
|
|
item: BoardsPackage;
|
|
progressId: string;
|
|
}): Promise<void> {
|
|
await super.uninstall({ item, progressId });
|
|
this.messageService.info(
|
|
nls.localize(
|
|
'arduino/board/succesfullyUninstalledPlatform',
|
|
'Successfully uninstalled platform {0}:{1}',
|
|
item.name,
|
|
item.installedVersion!
|
|
),
|
|
{ timeout: 3000 }
|
|
);
|
|
}
|
|
}
|