redesigned the settings menu group.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta
2020-07-20 22:02:54 +02:00
parent 12a13b869c
commit bbf880d187
8 changed files with 98 additions and 16 deletions

View File

@@ -0,0 +1,42 @@
import { inject, injectable } from 'inversify';
import { open, OpenerService } from '@theia/core/lib/browser/opener-service';
import { CommonCommands } from '@theia/core/lib/browser/common-frontend-contribution';
import { URI, Command, MenuModelRegistry, CommandRegistry, SketchContribution } from './contribution';
import { ArduinoMenus } from '../menu/arduino-menus';
@injectable()
export class Settings extends SketchContribution {
@inject(OpenerService)
protected readonly openerService: OpenerService;
registerCommands(registry: CommandRegistry): void {
registry.registerCommand(Settings.Commands.OPEN_CLI_CONFIG, {
execute: () => this.configService.getCliConfigFileUri().then(uri => open(this.openerService, new URI(uri)))
});
}
registerMenus(registry: MenuModelRegistry): void {
registry.registerMenuAction(ArduinoMenus.FILE__SETTINGS_GROUP, {
commandId: CommonCommands.OPEN_PREFERENCES.id,
label: 'Preferences...',
order: '0'
});
registry.registerMenuAction(ArduinoMenus.FILE__SETTINGS_GROUP, {
commandId: Settings.Commands.OPEN_CLI_CONFIG.id,
label: 'Open CLI Configuration',
order: '1',
});
}
}
export namespace Settings {
export namespace Commands {
export const OPEN_CLI_CONFIG: Command = {
id: 'arduino-open-cli-config',
label: 'Open CLI Configuration',
category: 'Arduino'
}
}
}