MenuManager

Summary

Provides a registry for menu items that you'd like to appear in the application menu.

An instance of this class is always available as the atom.menu global.

Here is an example from the tree-view:

[
  {
    'label': 'View'
    'submenu': [
      { 'label': 'Toggle Tree View', 'command': 'tree-view:toggle' }
    ]
  }
  {
    'label': 'Packages'
    'submenu': [
      'label': 'Tree View'
      'submenu': [
        { 'label': 'Focus', 'command': 'tree-view:toggle-focus' }
        { 'label': 'Toggle', 'command': 'tree-view:toggle' }
        { 'label': 'Reveal Active File', 'command': 'tree-view:reveal-active-file' }
        { 'label': 'Toggle Tree Side', 'command': 'tree-view:toggle-side' }
      ]
    ]
  }
]

Use in your package's menu .cson file requires that you place your menu structure under a menu key.

'menu': [
  {
    'label': 'View'
    'submenu': [
      { 'label': 'Toggle Tree View', 'command': 'tree-view:toggle' }
    ]
  }
]

See add for more info about adding menu's directly.

Instance Methods

add(items)

Adds the given items to the application menu.

Parameters
Argument Description
items

An Array of menu item Objects containing the keys:

Returns
Return Values

Returns a {Disposable} on which .dispose() can be called to remove the added menu items.

update()

Refreshes the currently visible menu.