Class CommonFrontendContribution

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

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

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>
preferenceService: PreferenceService
preferences: CorePreferences
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