blob: 4c8024e15dabda8951f24bd33a9adad6334a15eb [file] [log] [blame]
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.ui">
<annotation>
<appInfo>
<meta.schema plugin="org.eclipse.ui" id="menus" name="Menus"/>
</appInfo>
<documentation>
&lt;p&gt;
This extension point allows the plug-in developer to define menus, separators, logical groups and menu items -- appearing anywhere within the application, from status lines to context menus. It also allows sets of such contributions to be defined (i.e., action sets); these action sets can be turned on or off by the end user. In brief, the menus extension point contains all of the presentation elements (except the icons) for contributing to any menu, tool bar or status line in Eclipse.
&lt;/p&gt;
&lt;p&gt;
Every element within this extension point is given a unique identifier. This is so that these elements can be referred to elsewhere without having to restate the element. For example, the identifier might be required for ordering or for defining an action set. Also, this allows third-party plug-in developers to place these elements in new locations within the interface, as appropriate.
&lt;/p&gt;
</documentation>
</annotation>
<include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
<element name="extension">
<complexType>
<sequence>
<element ref="item" minOccurs="0" maxOccurs="unbounded"/>
<element ref="menu" minOccurs="0" maxOccurs="unbounded"/>
<element ref="group" minOccurs="0" maxOccurs="unbounded"/>
<element ref="widget" minOccurs="0" maxOccurs="unbounded"/>
<element ref="actionSet" minOccurs="0" maxOccurs="unbounded"/>
<element ref="modification" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
org.eclipse.ui.menus
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
An optional identifier of the extension instance.
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
An optional name of the extension instance.
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="item">
<annotation>
<documentation>
&lt;p&gt;
An item could be a menu item or a tool item, depending on where it is placed. It could also be something in the status line. The text and image associated with the item will be drawn from the command.
&lt;/p&gt;
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
<element ref="location" minOccurs="0" maxOccurs="unbounded"/>
<element ref="visibleWhen" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
A unique identifier for this item. It is recommended that the identifier be prefixed by the plug-in name, to guarantee uniqueness. For example, an item contributed by &lt;code&gt;org.eclipse.ui&lt;/code&gt; might be called &lt;code&gt;org.eclipse.ui.item1&lt;/code&gt;.
</documentation>
</annotation>
</attribute>
<attribute name="commandId" type="string" use="required">
<annotation>
<documentation>
The identifier of the command that should be executed when this item is triggered by the user. Commands are defined in the &lt;a href=&quot;org_eclipse_ui_commands.html&quot;&gt;commands extension point&lt;/a&gt;.
</documentation>
</annotation>
</attribute>
<attribute name="menuId" type="string">
<annotation>
<documentation>
Attaches a drop-down menu to a tool item. If this item appears somewhere other than a tool bar, then a warning will be printed to the log on start-up.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="menu">
<annotation>
<appInfo>
<meta.element labelAttribute="label"/>
</appInfo>
<documentation>
&lt;p&gt;
A menu can appear either attached to a tool item, or somewhere within a view menu, context menu or the top-level menu bar. For free, the plug-in developer can assume that there is a menu and tool bar for every view, and that the top-level menu bar exists. Context menus must be registered programmatically before they can be used (see API Information).
&lt;/p&gt;
&lt;p&gt;
A menu can only contain groups.
&lt;/p&gt;
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="location" minOccurs="0" maxOccurs="unbounded"/>
<element ref="dynamic" minOccurs="0" maxOccurs="1"/>
<element ref="visibleWhen" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
A unique identifier for this menu. It is recommended that the identifier be prefixed by the plug-in name, to guarantee uniqueness. For example, a menu contributed by &lt;code&gt;org.eclipse.ui&lt;/code&gt; might be called &lt;code&gt;org.eclipse.ui.menu1&lt;/code&gt;.
</documentation>
</annotation>
</attribute>
<attribute name="label" type="string">
<annotation>
<documentation>
The human-readable text to associate with this menu.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="group">
<annotation>
<documentation>
&lt;p&gt;
A logical group. It can either be visible (e.g., separators are drawn before and after, as appropriate) or invisible. By default, logicial groups are visible.
&lt;/p&gt;
&lt;p&gt;
A group can contain menus, items and other groups.
&lt;/p&gt;
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="location" minOccurs="0" maxOccurs="unbounded"/>
<element ref="dynamic" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
A unique identifier for this group. It is recommended that the identifier be prefixed by the plug-in name, to guarantee uniqueness. For example, a group contributed by &lt;code&gt;org.eclipse.ui&lt;/code&gt; might be called &lt;code&gt;org.eclipse.ui.group1&lt;/code&gt;.
</documentation>
</annotation>
</attribute>
<attribute name="separatorsVisible" type="boolean" use="default" value="true">
<annotation>
<documentation>
Whether separators should be drawn around the group. The workbench will take care of deciding whether a separator needs to be drawn at the top or bottom -- accounting for the top and bottom of the menu and duplicate separators. By default, separators are visible.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="widget">
<annotation>
<documentation>
A menu elements that is given direct access to the widgets. For example, this can be used to render a combo box. Unfortunately, this means that if a widget element becomes visible in the user interface, this will lead to plug-in loading. &lt;strong&gt;Use this element with caution, as it can cause performance problems.&lt;/strong&gt; This also will cause problems for things like macro support, scripting and pretty much any other command-based mechanism.
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="location" minOccurs="0" maxOccurs="unbounded"/>
<element ref="class" minOccurs="0" maxOccurs="1"/>
<element ref="visibleWhen" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
A unique identifier for this widget. It is recommended that the identifier be prefixed by the plug-in name, to guarantee uniqueness. For example, a widget contributed by &lt;code&gt;org.eclipse.ui&lt;/code&gt; might be called &lt;code&gt;org.eclipse.ui.widget1&lt;/code&gt;.
</documentation>
</annotation>
</attribute>
<attribute name="class" type="string">
<annotation>
<documentation>
This class is loaded to fill the appropriate spot in the menu, tool bar or status line when it shows. This class must implement &lt;code&gt;IWidget&lt;/code&gt;. It is possible to use the &lt;code&gt;class&lt;/code&gt; element instead.
</documentation>
<appInfo>
<meta.attribute kind="java"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="location">
<annotation>
<documentation>
A location in which a &lt;code&gt;menu&lt;/code&gt;, &lt;code&gt;group&lt;/code&gt;, &lt;code&gt;item&lt;/code&gt; or &lt;code&gt;widget&lt;/code&gt; can appear. This element is used to control location-specific information.
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="order" minOccurs="0" maxOccurs="unbounded"/>
<choice>
<element ref="bar"/>
<element ref="part"/>
<element ref="popup"/>
</choice>
</sequence>
<attribute name="mnemonic" type="string">
<annotation>
<documentation>
The mnemonic that should be associated with this element in the given location. A mnemonic should be a single character.
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
<attribute name="imageStyle" type="string">
<annotation>
<documentation>
The image style to associate with this location. It is possible for commands to have different styles of images associated with them. For example, a different icon could be selected for the tool bar and for the menu. This is especially important for developers using drop-down tool items in the tool bar, as they may wish to display an icon more appropriate for the drop-down.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="bar">
<annotation>
<documentation>
A leaf element within a location. This can be the menu bar, the tool bar or the status line. If unqualified, this indicates the top-level menu bar, tool bar or status line. If this is qualified with a &lt;code&gt;part&lt;/code&gt; element, then this indicates that part&apos;s menu, tool bar or status line.
</documentation>
</annotation>
<complexType>
<attribute name="type" use="required">
<annotation>
<documentation>
What type of bar to contribute to. This can be &lt;code&gt;menu&lt;/code&gt;, &lt;code&gt;tool&lt;/code&gt; or &lt;code&gt;status&lt;/code&gt;.
</documentation>
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="menu">
</enumeration>
<enumeration value="tool">
</enumeration>
<enumeration value="status">
</enumeration>
</restriction>
</simpleType>
</attribute>
<attribute name="path" type="string">
<annotation>
<documentation>
The path from the root of the bar, including menus and groups. This path uses &lt;code&gt;&apos;/&apos;&lt;/code&gt; as a separator character.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="class">
<annotation>
<documentation>
A class element supporting the executable extension parsing syntax for both &lt;code&gt;widget&lt;/code&gt; and &lt;code&gt;dynamic&lt;/code&gt; elements.
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
The class to load as an &lt;code&gt;IExecutableExtension&lt;/code&gt;.
</documentation>
<appInfo>
<meta.attribute kind="java"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="modification">
<annotation>
<documentation>
&lt;p&gt;
Allows modifications to be applied to existing elements. This has the capacity to copy an element into a new location, or to move an element into a new location. In either case, anything that tries to refer to the element in the old location will also refer to the new location.
&lt;/p&gt;
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="location"/>
<element ref="reference"/>
</sequence>
<attribute name="removeExisting" type="boolean" use="default" value="false">
<annotation>
<documentation>
Whether the existing locations for the element should be removed.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="visibleWhen">
<annotation>
<documentation>
Controls the visibility of the given element.
</documentation>
</annotation>
<complexType>
<choice>
<element ref="not"/>
<element ref="or"/>
<element ref="and"/>
<element ref="instanceof"/>
<element ref="test"/>
<element ref="systemTest"/>
<element ref="equals"/>
<element ref="count"/>
<element ref="with"/>
<element ref="resolve"/>
<element ref="adapt"/>
<element ref="iterate"/>
</choice>
<attribute name="checkEnabled" type="boolean" use="default" value="false">
<annotation>
<documentation>
If this attribute is set to &lt;code&gt;true&lt;/code&gt;, then there should be no sub-elements. This just checks the enabled state of the command, and makes the corresponding element visible if the command is enabled.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="actionSet">
<annotation>
<documentation>
&lt;p&gt;
A named group of elements. The workbench allows the user to view action sets, and disable or enable them as desired. It is also possible for certain action sets to be associated with particular parts or perspectives.
&lt;/p&gt;
&lt;p&gt;
An action set has a name and a unique identifier. It is also possible to specify whether the action set should be visible by default. Within the action set is simply a list of references to menus, groups, items and widgets that have been declared elsewhere.
&lt;/p&gt;
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="reference" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
A unique identifier for this action set. It is recommended that the identifier be prefixed by the plug-in name, to guarantee uniqueness. For example, an action set contributed by &lt;code&gt;org.eclipse.ui&lt;/code&gt; might be called &lt;code&gt;org.eclipse.ui.actionSet1&lt;/code&gt;.
</documentation>
</annotation>
</attribute>
<attribute name="label" type="string" use="required">
<annotation>
<documentation>
The human-readable text to associate with this action set. This text will appear in the &quot;Customize Perspective&quot; dialog.
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
<attribute name="description" type="string">
<annotation>
<documentation>
A longer human-readable description of the action set.
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
<attribute name="visible" type="string" use="default" value="false">
<annotation>
<documentation>
Whether the action set should be visible by default. If an action set is not visible, then the associated elements will not be visible. If an action set is visible, then the &lt;code&gt;visibleWhen&lt;/code&gt; criteria for the associated elements will be evaluated as normal. By default, action sets are not visible.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="part">
<annotation>
<documentation>
&lt;p&gt;
An element within a location. This qualifies the location to refer to a particular workbench part. This can be either a view or an editor. The qualification can use either the class name of the part (including inheritance), or it can refer to the identifier for the view or editor.
&lt;/p&gt;
&lt;p&gt;
Only one of &lt;code&gt;id&lt;/code&gt; and &lt;code&gt;class&lt;/code&gt; can be specified.
&lt;/p&gt;
</documentation>
</annotation>
<complexType>
<choice>
<element ref="popup"/>
<element ref="part"/>
</choice>
<attribute name="id" type="string">
<annotation>
<documentation>
The identifier of the view or editor.
</documentation>
</annotation>
</attribute>
<attribute name="class" type="string">
<annotation>
<documentation>
The class of the part. This can be a superclass, interface or superinterface of the part, and it will still match.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="reference">
<annotation>
<documentation>
A reference to an already existing element. This is used for action sets and modifications.
</documentation>
</annotation>
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
The identifier of the element to which this reference refers.
</documentation>
</annotation>
</attribute>
<attribute name="type" use="required">
<annotation>
<documentation>
The type of element to which this reference refers. This is only required if there are elements of different types with the same id.
</documentation>
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="menu">
</enumeration>
<enumeration value="group">
</enumeration>
<enumeration value="item">
</enumeration>
<enumeration value="widget">
</enumeration>
</restriction>
</simpleType>
</attribute>
</complexType>
</element>
<element name="dynamic">
<annotation>
<appInfo>
<meta.element labelAttribute="class"/>
</appInfo>
<documentation>
Allows modification of a group or menu as its about to show. Unfortunately, this means that if the corresponding group or menu becomes visible in the user interface, this will lead to plug-in loading. &lt;strong&gt;Use this element with caution, as it can cause performance problems.&lt;/strong&gt;
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="class"/>
</sequence>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
This class is loaded to modify the appropriate group or menu when it shows. This class must implement &lt;code&gt;IDynamicMenu&lt;/code&gt;. It is possible to use the &lt;code&gt;class&lt;/code&gt; element instead.
</documentation>
<appInfo>
<meta.attribute kind="java"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="parameter">
<annotation>
<documentation>
A parameter to either an executable extension or a command -- depending on where it appears in the extension.
</documentation>
</annotation>
<complexType>
<attribute name="name" type="string" use="required">
<annotation>
<documentation>
The name is either the name of the parameter to pass to the executable extension, or the identifier of the parameter for the command.
</documentation>
</annotation>
</attribute>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>
The value to pass for this parameter.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="order">
<annotation>
<documentation>
Controls the position of a menu, group, item or widget within a particular location.
</documentation>
</annotation>
<complexType>
<attribute name="position" use="required">
<annotation>
<documentation>
&lt;p&gt;
This attribute accepts the following values: &lt;code&gt;start&lt;/code&gt; (put the element at the beginning of the container); &lt;code&gt;end&lt;/code&gt; (put the element at the end of its container); &lt;code&gt;after&lt;/code&gt; (put the element after the sibling element whose id matches &lt;code&gt;ref&lt;/code&gt;); and, &lt;code&gt;before&lt;/code&gt; (put the element before the sibling element whose id matches &lt;code&gt;ref&lt;/code&gt;). Relative ordering can be applied to any type of menu element.
&lt;/p&gt;
&lt;p&gt;
In the event of conflicts, Eclipse will chose an arbitrary order. The only guarantee is that, in the event of a conflict, the order will remain the same as long as the following holds:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The Eclipse version is the same.&lt;/li&gt;
&lt;li&gt;The list of elements is the same (i.e., no dynamic elements, no plug-ins added or removed).&lt;/li&gt;
&lt;/ul&gt;
</documentation>
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="start">
</enumeration>
<enumeration value="end">
</enumeration>
<enumeration value="before">
</enumeration>
<enumeration value="after">
</enumeration>
</restriction>
</simpleType>
</attribute>
<attribute name="relativeTo" type="string">
<annotation>
<documentation>
The identifier of the element to which this position is relative. This value is required if the &lt;code&gt;position&lt;/code&gt; is &lt;code&gt;before&lt;/code&gt; or &lt;code&gt;after&lt;/code&gt;.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="popup">
<annotation>
<documentation>
Part of a location. It indicates that the menu, group, item or widget should appear in the popup menu.
</documentation>
</annotation>
<complexType>
<attribute name="id" type="string">
<annotation>
<documentation>
The identifier of the popup menu. If none is specified, then it will appear in all popup menus.
</documentation>
</annotation>
</attribute>
<attribute name="path" type="string">
<annotation>
<documentation>
The path within the popup menu to place the element. If not specified, then this is added to the &quot;additions&quot; group.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
3.2
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
&lt;p&gt;
A basic menu definition looks like this.
&lt;/p&gt;
&lt;pre&gt;
&lt;menu
id=&quot;com.mycompany.myplugin.projection&quot;
label=&quot;%Folding.label&quot;&gt;
&lt;location mnemonic=&quot;%Folding.label.mnemonic&quot;&gt;
&lt;part id=&quot;AntEditor&quot;&gt;
&lt;popup id=&quot;#RulerContext&quot; path=&quot;rest&quot; /&gt;
&lt;/part&gt;
&lt;/location&gt;
&lt;/menu&gt;
&lt;/pre&gt;
&lt;p&gt;
In this example, the plug-in developer is contributing to all parts who subclass or implement the given type. This allows, for example, for some contributions to be added to all text editors.
&lt;/p&gt;
&lt;pre&gt;
&lt;menu
id=&quot;com.mycompany.myplugin.textEditorMenu&quot;
label=&quot;Text Commands&quot;&gt;
&lt;location mnemonic=&quot;X&quot;&gt;
&lt;part class=&quot;AbstractTextEditor&quot;&gt;
&lt;popup id=&quot;#RulerContext&quot; path=&quot;rest&quot; /&gt;
&lt;/part&gt;
&lt;/location&gt;
&lt;/menu&gt;
&lt;/pre&gt;
&lt;p&gt;
To define a dynamic menu, the &lt;code&gt;dynamic&lt;/code&gt; element is used. The only real difference here is that the menu defines a call-back class. This class is notified when the menu is about to change from not showing to showing. At this point, the class is given a chance to modify the contents of its group.
&lt;/p&gt;
&lt;pre&gt;
&lt;menu
id=&quot;com.mycompany.myplugin.DynamicMenu&quot;
label=&quot;%DynamicMenu.label&quot;&gt;
&lt;dynamic class=&quot;DynamicMenu&quot; /&gt;
&lt;location mnemonic=&quot;%mnemonic&quot;&gt;
&lt;menubar path=&quot;org.eclipse.ui.run/runGroup&quot; /&gt;
&lt;/location&gt;
&lt;/menu&gt;
&lt;/pre&gt;
&lt;p&gt;
It is possible to associate help with a menu.
&lt;/p&gt;
&lt;pre&gt;
&lt;menu
id=&quot;com.mycompany.myplugin.RunWithConfigurationAction&quot;
label=&quot;Run With Configuration&quot;
helpContextId=&quot;run_with_configuration_context&quot;&gt;
&lt;location&gt;
&lt;menubar /&gt;
&lt;/location&gt;
&lt;/menu&gt;
&lt;/pre&gt;
&lt;p&gt;
Within a menu, it is possible to define logical groups. These logical groups can either be visible (e.g., separators are drawn before and after, as appropriate) or invisible. By default, logicial groups are visible.
&lt;/p&gt;
&lt;pre&gt;
&lt;group id=&quot;com.mycompany.myplugin.stepGroup&quot;&gt;
&lt;location&gt;
&lt;menubar path=&quot;org.eclipse.ui.run&quot; /&gt;
&lt;/location&gt;
&lt;/group&gt;
&lt;group
id=&quot;com.mycompany.myplugin.stepIntoGroup&quot;
separatorsVisible=&quot;false&quot; &gt;
&lt;location&gt;
&lt;menubar path=&quot;org.eclipse.ui.run&quot; /&gt;
&lt;/location&gt;
&lt;/group&gt;
&lt;/pre&gt;
&lt;p&gt;
Groups can be declared to be dynamic, in the same way as menus.
&lt;/p&gt;
&lt;pre&gt;
&lt;group
id=&quot;com.mycompany.myplugin.runHistory&quot;&gt;
&lt;dynamic class=&quot;DynamicRunHistoryGroup&quot; /&gt;
&lt;location&gt;
&lt;menubar path=&quot;org.eclipse.ui.run/runGroup&quot; /&gt;
&lt;/location&gt;
&lt;/group&gt;
&lt;/pre&gt;
&lt;p&gt;
It is possible to place menus, group, items and widgets in multiple locations.
&lt;/p&gt;
&lt;pre&gt;
&lt;item
id=&quot;com.mycompany.myplugin.ToggleStepFilters&quot;
commandId=&quot;com.mycompany.myplugin.ToggleStepFilters&quot;&gt;
&lt;location mnemonic=&quot;%mnemonic&quot;&gt;
&lt;menubar path=&quot;org.eclipse.ui.run/emptyStepGroup&quot; /&gt;
&lt;/location&gt;
&lt;location&gt;
&lt;part id=&quot;org.eclipse.debug.ui.DebugView&quot;&gt;
&lt;toolbar path=&quot;renderGroup&quot; /&gt;
&lt;/part&gt;
&lt;/location&gt;
&lt;location mnemonic=&quot;%mnemonic&quot;&gt;
&lt;part id=&quot;org.eclipse.debug.ui.DebugView&quot;&gt;
&lt;popup path=&quot;renderGroup&quot; /&gt;
&lt;/part&gt;
&lt;/location&gt;
&lt;/item&gt;
&lt;/pre&gt;
&lt;p&gt;
If the popup element is specified with no id and no parent part element, then it applies to any context menu registered with the workbench. This is similar to the behaviour of the old object contributions. Similarly, a top-level popup element with an id will affect any context menu registered with the given name.
&lt;/p&gt;
&lt;pre&gt;
&lt;item
id=&quot;com.mycompany.myplugin.ObjectContribution&quot;
commandId=&quot;com.mycompany.myplugin.ObjectContribution&quot;&gt;
&lt;location&gt;
&lt;popup path=&quot;additions&quot; /&gt;
&lt;/location&gt;
&lt;/item&gt;
&lt;/pre&gt;
&lt;p&gt;
Sometimes, you might want to control the visibility of an item. While normally it is preferrable to maintain stability in the layout of menus and tool bars, it is sometimes desirable to hide items that aren&apos;t immediately relevent. This is particularly true on context menus, where space is limited. In this case, you would define a &lt;code&gt;visibleWhen&lt;/code&gt; element. This element is almost identical to the &lt;code&gt;activeWhen&lt;/code&gt; and &lt;code&gt;enabledWhen&lt;/code&gt; elements defined in the &lt;a href=&quot;org_eclipse_ui_handlers.html&quot;&gt;handlers extension point&lt;/a&gt;.
&lt;/p&gt;
&lt;pre&gt;
&lt;item
id=&quot;com.mycompany.myplugin.ConvertToWatchExpression&quot;
commandId=&quot;com.mycompany.myplugin.ConvertToWatchExpression&quot;&gt;
&lt;location mnemonic=&quot;%mnemonic&quot;&gt;
&lt;part id=&quot;org.eclipse.debug.ui.DebugView&quot;&gt;
&lt;popup path=&quot;additions&quot; /&gt;
&lt;/part&gt;
&lt;/location&gt;
&lt;visibleWhen&gt;
&lt;with variable=&quot;selection&quot;&gt;
&lt;iterate operator=&quot;and&quot;&gt;
&lt;not&gt;
&lt;instanceof value=&quot;IWatchExpression&quot;/&gt;
&lt;/not&gt;
&lt;instanceof value=&quot;IExpression&quot; /&gt;
&lt;/iterate&gt;
&lt;/with&gt;
&lt;/visibleWhen&gt;
&lt;/item&gt;
&lt;/pre&gt;
&lt;p&gt;
The most common case is simply to make something visible when its handler is enabled. This is handled with some syntactic sugar. There is a &lt;code&gt;checkEnabled&lt;/code&gt; attribute on the &lt;code&gt;visibleWhen&lt;/code&gt; element.
&lt;/p&gt;
&lt;pre&gt;
&lt;item
id=&quot;com.mycompany.myplugin.compareWithPatch&quot;
commandId=&quot;com.mycompany.myplugin.compareWithPatch&quot;&gt;
&lt;location mnemonic=&quot;%mnemonic&quot;&gt;
&lt;part id=&quot;MyPart&quot;&gt;
&lt;popup path=&quot;additions&quot; /&gt;
&lt;/part&gt;
&lt;/location&gt;
&lt;visibleWhen checkEnabled=&quot;true&quot; /&gt;
&lt;/item&gt;
&lt;/pre&gt;
&lt;p&gt;
Any item associated with a command can include parameter values. If the parameter of the given identifier is not defined, this is an error. If the item does not have a command, then this is also an error.
&lt;/p&gt;
&lt;pre&gt;
&lt;item
id=&quot;com.mycompany.myplugin.RunHistory&quot;
commandId=&quot;com.mycompany.myplugin.RunHistory&quot;&gt;
&lt;location&gt;
&lt;menubar path=&quot;org.eclipse.ui.run&quot; /&gt;
&lt;/location&gt;
&lt;parameter name=&quot;index&quot; value=&quot;1&quot; /&gt;
&lt;/item&gt;
&lt;/pre&gt;
&lt;p&gt;
It also possible to specify relative ordering. This is done using the order attribute on the location element. The order attribute accepts the following values: &lt;code&gt;start&lt;/code&gt; (put the element at the beginning of the container); end (put the element at the end of its container); &lt;code&gt;after&lt;/code&gt; (put the element after the sibling element whose id matches &lt;code&gt;ref&lt;/code&gt;); and, &lt;code&gt;before&lt;/code&gt; (put the element before the sibling element whose id matches &lt;code&gt;ref&lt;/code&gt;). Relative ordering can be applied to any type of menu element.
&lt;/p&gt;
&lt;pre&gt;
&lt;item
id=&quot;com.mycompany.myplugin.MyFirstItem&quot;
commandId=&quot;com.mycompany.myplugin.MyFirstCommand&quot;&gt;
&lt;location&gt;
&lt;order position=&quot;start&quot; /&gt;
&lt;menubar path=&quot;org.eclipse.ui.run&quot; /&gt;
&lt;/location&gt;
&lt;/item&gt;
&lt;item
id=&quot;com.mycompany.myplugin.MySecondItem&quot;
commandId=&quot;com.mycompany.myplugin.MySecondCommand&quot;&gt;
&lt;location&gt;
&lt;order position=&quot;after&quot; relativeTo=&quot;com.mycompany.myplugin.MyFirstItem&quot; /&gt;
&lt;menubar path=&quot;org.eclipse.ui.run&quot; /&gt;
&lt;/location&gt;
&lt;/item&gt;
&lt;/pre&gt;
&lt;p&gt;
If you require direct access to the widgets (e.g., for rendering a combo box), then you can use a &lt;code&gt;widget&lt;/code&gt; element. Unfortunately, this means that if a widget element becomes visible in the user interface, this will lead to plug-in loading.
&lt;/p&gt;
&lt;pre&gt;
&lt;widget
id=&quot;com.mycompany.myplugin.MyComboBoxSimple&quot;
class=&quot;com.mycompany.myplugin.MyComboBox&quot;&gt;
&lt;location&gt;
&lt;toolbar path=&quot;myGroup&quot;&gt;
&lt;/location&gt;
&lt;/widget&gt;
&lt;widget
id=&quot;com.mycompany.myplugin.MyComboBoxParameterized1&quot;
class=&quot;com.mycompany.myplugin.MyComboBox:a,b,c&quot;&gt;
&lt;location&gt;
&lt;toolbar path=&quot;myGroup&quot; /&gt;
&lt;/location&gt;
&lt;/widget&gt;
&lt;widget
id=&quot;com.mycompany.myplugin.MyComboBoxParameterized2&quot;&gt;
&lt;class class=&quot;com.mycompany.myplugin.MyComboBox&quot;&gt;
&lt;parameter name=&quot;list&quot; value=&quot;a,b,c&quot; /&gt;
&lt;parameter name=&quot;selected&quot; value=&quot;c&quot; /&gt;
&lt;parameter name=&quot;editable&quot; value=&quot;false&quot; /&gt;
&lt;/class&gt;
&lt;location&gt;
&lt;toolbar pathd=&quot;myGroup&quot; /&gt;
&lt;/location&gt;
&lt;/widget&gt;
&lt;/pre&gt;
&lt;p&gt;
The most complex contribution is probably the tool bar item with a drop-down menu, where the icon should represent the drop-down menu (and not the tool bar item&apos;s command). In this example, the item has a menu associated with it. This simply means that if the item is selected in a special way (e.g., clicking on the right part of a tool item drop-down), that this is the command that should be executed. By specifying an image style attribute on the location, it is possible to select a different set of images to associate with the menu.
&lt;/p&gt;
&lt;pre&gt;
&lt;item
id=&quot;com.mycompany.myplugin.ToolBarDropDown&quot;
commandId=&quot;com.mycompany.myplugin.ClickCommand&quot;&gt;
&lt;location imageStyle=&quot;toolbar&quot;&gt;
&lt;toolbar path=&quot;launchActionSet/debug&quot; /&gt;
&lt;/location&gt;
&lt;/item&gt;
&lt;menu
id=&quot;com.mycompany.myplugin.DynamicMenuWithCommand&quot;
label=&quot;%DynamicMenuWithCommand.label&quot;&gt;
&lt;dynamic class=&quot;com.mycompany.myplugin.DynamicMenu&quot; /&gt;
&lt;/menu&gt;
&lt;/pre&gt;
&lt;p&gt;
It is possible to define action sets, or groups of elements with a name. The workbench allows the user to view acton sets, and disable or enable them as desired. It is also possible for certain action sets to be associated with particular parts or perspectives.
&lt;/p&gt;
&lt;pre&gt;
&lt;actionSet
label=&quot;%ProfileActionSet.label&quot;
visible=&quot;false&quot;
id=&quot;org.eclipse.debug.ui.profileActionSet&quot;&gt;
&lt;reference id=&quot;ProfileDropDownAction&quot; type=&quot;menu&quot;/&gt;
&lt;reference id=&quot;ProfileWithConfigurationAction&quot; type=&quot;menu&quot;/&gt;
&lt;reference id=&quot;ProfileHistoryMenuAction&quot; type=&quot;menu&quot; /&gt;
&lt;reference id=&quot;OpenProfileConfigurations&quot; type=&quot;item&quot;/&gt;
&lt;reference id=&quot;ProfileLast&quot; type=&quot;item&quot;/&gt;
&lt;/actionSet&gt;
&lt;/pre&gt;
&lt;p&gt;
It is possible to add an existing menu element of any kind (i.e., menu, group, item) to a new location. This allows third-party plug-in developers to include an existing definition in some new location -- perhaps in a new view or editor -- without needing to worry about things like externalized strings. A reference inherits all of its properties from the element to which it refers.
&lt;/p&gt;
&lt;pre&gt;
&lt;modification&gt;
&lt;reference id=&quot;SomeoneElsesMenu&quot; type=&quot;menu&quot; /&gt;
&lt;location&gt;
&lt;menubar path=&quot;org.eclipse.ui.run&quot; /&gt;
&lt;/location&gt;
&lt;/modification&gt;
&lt;/pre&gt;
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
To register a context menu, use the &lt;code&gt;IWorkbenchPartSite.registerContextMenu&lt;/code&gt; methods.
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
<documentation>
Copyright (c) 2005 IBM Corporation and others.&lt;br&gt;
All rights reserved. This program and the accompanying materials are made
available under the terms of the Eclipse Public License v1.0 which accompanies
this distribution, and is available at &lt;a
href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
</documentation>
</annotation>
</schema>