Representation of a menu contribution.
Note that there are also convenience classes which combine multiple contributions into one. For example to register a view together with a menu and keybinding you could use AbstractViewContribution instead.
import { MenuContribution, MenuModelRegistry, MAIN_MENU_BAR } from '@theia/core';@injectable()export class NewMenuContribution implements MenuContribution { registerMenus(menus: MenuModelRegistry): void { const menuPath = [...MAIN_MENU_BAR, '99_mymenu']; menus.registerSubmenu(menuPath, 'My Menu'); menus.registerMenuAction(menuPath, { commandId: MyCommand.id, label: 'My Action' }); }} Copy
import { MenuContribution, MenuModelRegistry, MAIN_MENU_BAR } from '@theia/core';@injectable()export class NewMenuContribution implements MenuContribution { registerMenus(menus: MenuModelRegistry): void { const menuPath = [...MAIN_MENU_BAR, '99_mymenu']; menus.registerSubmenu(menuPath, 'My Menu'); menus.registerMenuAction(menuPath, { commandId: MyCommand.id, label: 'My Action' }); }}
Registers menus.
the menu model registry.
Representation of a menu contribution.
Note that there are also convenience classes which combine multiple contributions into one. For example to register a view together with a menu and keybinding you could use AbstractViewContribution instead.
Example usage