Use this extension point to add menu items to an existing menus that define an extension point. The com.blocks.BUserInterface.menus
extension point has three configuration elements, menu
, menuitem
, and separator
.
menu
Themenu
configuration element is used to assign a unique id to aNSMenu
this is being built. It has a singleid
attribute that should either refere to a new menu that you are declaring, or to another menu declared elsewhere that you wish to extend. Themenu
element can contain bothmenuitem
andseparator
elements.menuitem
Themenuitem
configuration element is used to addNSMenuItems
to a menu. This element has a number of attributes:title
The title that will be used for theNSMenuItem
id
Unique id that others can use to refere to the menu item (for example when declaring insert postion you can insert relative to an already defined menu item that you refere to by id.action
The selector action that will be sent to the menu item's target.target
The object that will be the menu's target.keyEquivalent
The menu items key equivalent.keyEquivalentModifierMask
The modify mask for the keyEquivalent, for exampleNSCommandKeyMask|NSAlternateKeyMask
.location
The location that this menu item should be inserted, relative to an existinggroup
or menu itemid
that also exists in the menu that's being extended. For examplegroup:preferencesGroup
means to insert in the grouppreferencesGroup
wich is defined by aseparator
element. Orafter:about
means to insert the menu item after the menu item with the idabout
.submenu
id of the menu that should be used as a submenu of the menu item.
separator
Used to insert a separator and declar a group id. This element can have the attributes:group
id of the group being defined.location
Same as location attributed used inmenuitem
element.
This example shows how the BPreferencesController adds a separator group and a preferences menu item to the com.blocks.BUserInterface.menus.main.application
menu that's defined in BUserInterface's Plugin.xml:
<extension point="com.blocks.BUserInterface.menus" processOrder="1" >
<menu id="com.blocks.BUserInterface.menus.main.application">
<separator group="preferencesGroup" location="after:about"/>
<menuitem title="%Preferences..." id="preferences" action="showWindow:" keyEquivalent="," target="BPreferencesController sharedInstance" location="group:preferencesGroup" />
</menu>
</extension>
This example shows how to add a menu item that has a submenu, and how to add another item to that submenu:
<extension point="com.blocks.BUserInterface.menus">
<menu id="com.blocks.BUserInterface.menus.main">
<menuitem title="%ExampleMenuItem" id="exampleMenuItem" submenu="com.blocks.BUserInterface.menus.main.example" />
</menu>
<menu id="com.blocks.BUserInterface.menus.main.example">
<menuitem title="%OtherExampleMenuItem" id="otherExampleMenuItem" action="otherExampleItemAction:"/>
</menu>
</extension>