Class MenuModelRegistry

The MenuModelRegistry allows to register and unregister menus, submenus and actions via strings and MenuActions without the need to access the underlying UI representation.

Constructors

Properties

commands: CommandRegistry
isReady: boolean = false
menuNodeFactory: MenuNodeFactory
onDidChangeEmitter: Emitter<MenuChangedEvent> = ...

Accessors

Methods

  • Register a new menu at the given path with the given label. (If the menu already exists without a label, iconClass or order this method can be used to set them.)

    Parameters

    • menuPath: MenuPath

      the path for which a new submenu shall be registered.

    • label: string

      the label to be used for the new submenu.

    • options: {
          contextKeyOverlay?: Record<string, string>;
          icon?: string;
          sortString?: string;
          when?: string;
      } = {}

      optionally allows to set an icon class and specify the order of the new menu.

      • Optional contextKeyOverlay?: Record<string, string>
      • Optional icon?: string
      • Optional sortString?: string
      • Optional when?: string

    Returns Disposable

    if the menu was successfully created a disposable will be returned which, when called, will remove the menu again. If the menu already existed a no-op disposable will be returned.

    Note that if the menu already existed and was registered with a different label an error will be thrown.