Theia API Documentation v1.65.0
    Preparing search index...

    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'
    });
    }
    }

    Implements

    Index

    Constructors

    Properties

    aboutDialog: AboutDialog
    authenticationService: AuthenticationService
    clipboardService: ClipboardService
    commandRegistry: CommandRegistry
    commonDecorationsStyleSheet: CSSStyleSheet = ...
    contextKeyService: ContextKeyService
    encodingRegistry: EncodingRegistry
    environments: EnvVariablesServer
    iconThemes: IconThemeService
    inputFocus: ContextKey<boolean>
    languageQuickPickService: LanguageQuickPickService
    localizationProvider: AsyncLocalizationProvider
    menuRegistry: MenuModelRegistry
    messageService: MessageService
    openerService: OpenerService
    pinnedKey: ContextKey<boolean>
    preferences: CorePreferences
    preferenceService: PreferenceService
    quickInputService: QuickInputService
    resourceContextKey: ResourceContextKey
    saveResourceService: SaveableService
    selectionService: SelectionService
    shouldPreventClose: boolean = false
    storageService: StorageService
    themeService: ThemeService
    undoRedoHandlerService: UndoRedoHandlerService
    untitledResourceResolver: UntitledResourceResolver
    windowService: WindowService
    workingDirProvider: UserWorkingDirectoryProvider

    Methods

    • registers event listener which make sure that window doesn't get closed if CMD/CTRL W is pressed. Too many users have that in their muscle memory. Chrome doesn't let us rebind or prevent default the keybinding, so this at least doesn't close the window immediately.

      Returns void