< Previous | Next >

Lesson 4: Divide the menu for a profile

In this lesson, you divide a profile tooling menu.
Based on the UML model and profile that you created in Lesson 1, the default pop-up menu (named Add My Profile) should contain two stereotypes: <A> Actor and <B> Actor (note that associations are not shown on this pop-up menu). Instead of keeping single default menu, with both stereotypes, you create two separate pop-up menu, one for <A> Actor and one for Actor.

To divide the profile tooling menu into two menus:

  1. Return to the My Profile Tooling Project that you created in Lesson 1.
  2. In the Project Explorer view, open the My Profile tooling model, and expand the <<Menus>> Menus package.
  3. In the Properties view, on the Context Menu page, look at the properties of <<ContextMenu>> My Profile and notice that there is only one child, the <<FlyoutMenu>> Add My Profile. To create a new pop-up menu, you create a new FlyoutMenu and add it as a second child.
  4. Before you start, clean up the Add My Profile FlyoutMenu. In the Project Explorer view, click the <<FlyoutMenu>> Add My Profile and navigate to the General page of the Properties view. Then, rename this menu to something more meaningful: Add A Stuff.
  5. In the Properties view, click the FlyoutMenu tab. You should see one entry in the children property: the <<MenuGroup>> defaultGroup. Therefore, a pop-up menu is simply a <<ContextMenu>>, with links to children, which are <<FlyoutMenu>>, and these are linked to children which are of type <<MenuGroup>>.
    Note: To keep one pop-up menu (for example, Add My Profile ) but have separate flyout menus, you could do this by adding a second <<MenuGroup>> to the <<Flyout>> menu.
  6. To continue cleaning up the current menus, you use the defaultGroup menu group as the menu group for the “A” stuff, and create a new menu group for the “B” stuff. In the Project Explorer view, select the <<MenuGroup>> defaultGroup; then, in the Properties view, on the General page, rename the group to something more meaningful: AGroup.
  7. Click the MenuGroup tab and notice that two entries are listed under the children property.
  8. Delete the <<MenuCreationAction>><B> Actor child entry and close this window.
  9. In the Project Explorer view, right-click <<ContextMenu>> MyProfile; then click Add Diagram > Add ContextMenu Diagram. The diagram shows the pop-up menu (My Profile) with a child flyout menu (Add A Stuff). As the following figure illustrates, the Add A Stuff menu has a menu group child (AGroup), which has a creation action child (Actor).

    Context menu with flyout menu.

    Note: You can perform customization in diagrams; however, it is often quicker to perform the customization through the element properties. Remember that the associations in profile tooling do not behave as associations in, for instance, a class diagram. Similarly, it is only possible to delete an association from the diagram editor; this will not delete the actual underlying association between a flyout menu and its group.
  10. To create a new flyout menu and a new menu group for the “B” Stuff, select the FlyoutMenu tool from the Menus palette and drag it into the diagram editor; then, name it: Add B Stuff.
  11. Complete the same steps to create the MenuGroup tool and name it BGroup.
  12. To connect the Actor menu creation action with this new menu group, drag the <<MenuCreationAction>> <B> actor from the Project Explorer view into the diagram editor. Now the diagram contains the new flyout menu, the new menu group, and the original Actor menu creation item.
    New Flyout menu, new menu grpul and the original Actor creating item all added onto the diagram.
  13. To connect these elements, in the Palette, under Menus, use the MenuContainer children tool to connect the My Profile pop-up menu to the Add B Stuff flyout menu.
  14. Use the same tool to connect the Add B Stuff flyout menu to the BGroup menu group and the BGroup menu group to the <B> Actor menu creation item so the diagram looks like the following figure.

    Enter alt text.

  15. In the Project Explorer view, you can see the new FlyoutMenu element and the new MenuGroup element. Note that they are listed under ContextMenu My Profile because that is where the ContextMenuDiagram1 was created. Any element in a diagram is created in the same location as the diagram. If desired, you can close the diagram, move the new elements to other locations in the Project Explorer view, and then create a new ContextMenu diagram.
  16. You have finished the customization of the menu in the tooling model.
  17. Click File > Save to save your work.
    Remember: To generate or regenerate the profile tooling code, in the Project Explorer view, right-click the tooling model; then click Generate Tooling Code.
When you deploy the profile tooling plug-in and create a new model based on this profile, your palette should look like the following figure:

Newly created palette.

< Previous | Next >

Feedback