Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.
Create Hidden Sub-Menus
When you create items on a Toolbox page, some of them might be very similar and be based on the same type of Metaclass. For example, there are many different types of Action element and, in BPMN 2.0, you can create each type of Event element either stand-alone or edge-mounted on another element. Rather than populate a Toolbox page with every variation, you can create a 'base' Toolbox item and offer a choice of variant from a sub-menu, which is displayed when the base item is dragged onto the diagram but is otherwise hidden. This technique is very useful for 'disambiguating' Stereotypes that can be applied to multiple Metaclasses.
In the submenu, you define just the variant types (as for the Action element list). However, if the variant also has a ToolboxItemImage defined for it, that icon is displayed against the variant name in the sub-menu (as for the BPMN 2.0 Events). You can also use this method to specifically define icons that will be applied to the submenu options.
Define a hidden sub-menu
Step |
Action |
See also |
---|---|---|
1 |
Create a Stereotype element on the same diagram as the ToolboxPage Metaclass, with a name prefixed by the Profile name (this is mandatory). For example:
MyProfile::MySubmenu
The sub-menu element can have an alias.
|
|
2 |
In this sub-menu Stereotype element, create the attribute isHidden with an initial value of true. For each sub-menu item, add an attribute to identify that item. Set the Initial Value to the name to display in the menu. For example, if the �MySubmenu� stereotype could be applied to a UML Class or UML Interface, the attributes for these two options would be:
MyProfile::MySubmenu(UML::Class) Initial Value = Class MyProfile::MySubmenu(UML::Interface) Initial Value = Interface
|
|
3 |
Create a second Stereotype element and define an attribute with the same name as the sub-menu Stereotype element, and with the initial value of the text to display in the Toolbox item. For example:
MyProfile::MySubmenu = Class Object
Define additional attributes for the rest of the items in the Toolbox, as normal.
|
|
4 |
Create <<Extension>> relationships between each Stereotype element and the ToolboxPage Metaclass element, as illustrated.
When this Profile is in use, and when the Class Object item is dragged onto a diagram from the Toolbox, the hidden menu displays giving the choice of Class or Interface; on selection, the element is dropped onto the diagram.
|
|
5 |
If no icon has been assigned to the Toolbox item from existing definitions, and you want to display one, define the image as a ToolboxItemImage icon.
|