Files
arduino-ide/arduino-ide-extension/src/browser/theia/workspace/workspace-frontend-contribution.ts
Akos Kitta a74b159366 renamed customization folder to theia.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
2020-07-18 21:09:08 +02:00

39 lines
1.4 KiB
TypeScript

import { injectable } from 'inversify';
import { CommandRegistry } from '@theia/core/lib/common/command';
import { MenuModelRegistry } from '@theia/core/lib/common/menu';
import { WorkspaceCommands, FileMenuContribution } from '@theia/workspace/lib/browser/workspace-commands';
import { WorkspaceFrontendContribution as TheiaWorkspaceFrontendContribution } from '@theia/workspace/lib/browser/workspace-frontend-contribution';
@injectable()
export class WorkspaceFrontendContribution extends TheiaWorkspaceFrontendContribution {
registerCommands(registry: CommandRegistry): void {
super.registerCommands(registry);
// TODO: instead of blacklisting commands to remove, it would be more robust to whitelist the ones we want to keep
const commands = new Set(registry.commands);
[
WorkspaceCommands.OPEN,
WorkspaceCommands.OPEN_FILE,
WorkspaceCommands.OPEN_FOLDER,
WorkspaceCommands.OPEN_WORKSPACE,
WorkspaceCommands.OPEN_RECENT_WORKSPACE,
WorkspaceCommands.SAVE_WORKSPACE_AS,
WorkspaceCommands.SAVE_AS,
WorkspaceCommands.CLOSE
].filter(commands.has.bind(commands)).forEach(registry.unregisterCommand.bind(registry));
}
registerMenus(_: MenuModelRegistry): void {
}
}
@injectable()
export class ArduinoFileMenuContribution extends FileMenuContribution {
registerMenus(_: MenuModelRegistry): void {
// NOOP
}
}