Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

Hierarchy

Index

Constructors

constructor

Properties

Protected Readonly commands

commands: CommandRegistry

Protected Readonly contributions

Protected Readonly root

root: CompositeMenuNode = ...

Methods

Protected findGroup

Protected findSubMenu

getMenu

  • Returns the menu at the given path.

    Parameters

    • menuPath: MenuPath = []

      the path specifying the menu to return. If not given the empty path will be used.

    Returns CompositeMenuNode

    the root menu when menuPath is empty. If menuPath is not empty the specified menu is returned if it exists, otherwise an error is thrown.

onStart

  • onStart(): void

registerMenuAction

registerMenuNode

registerSubmenu

  • 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.

    • Optional options: SubMenuOptions

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

    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.

unregisterMenuAction

  • Unregister all menu nodes with the same id as the given menu action.

    Parameters

    • item: MenuAction

      the item whose id will be used.

    • Optional menuPath: MenuPath

      if specified only nodes within the path will be unregistered.

    Returns void

  • Unregister all menu nodes with the same id as the given command.

    Parameters

    • command: Command

      the command whose id will be used.

    • Optional menuPath: MenuPath

      if specified only nodes within the path will be unregistered.

    Returns void

  • Unregister all menu nodes with the given id.

    Parameters

    • id: string

      the id which shall be removed.

    • Optional menuPath: MenuPath

      if specified only nodes within the path will be unregistered.

    Returns void

unregisterMenuNode

  • unregisterMenuNode(id: string): void