Lesson 2: Generate a profile tooling model and related code
In this lesson, you create several stereotypes; then, you
generate a profile tooling model, and generate profile tooling code
from that model.
About this task
To generate a profile tooling model and related code:
Procedure
- In the Project Explorer view, expand the Profiles folder, right-click My Profile; then click Add Diagram > Class Diagram.
- Type the following name for the class diagram: Profile Class Diagram
- In the Profile class diagram, create a few stereotypes
with metaclass extensions as pictured in the following figure. You
use this simple profile to demonstrate profile tooling customization
later in this tutorial.
- Click File > Save.
- To generate the profile tooling model, in the Project
Explorer view, under Profiles, right-click My
Profile; then click Generate Profile Tooling
Model. Note: The Generate Profile Tooling Model command is displayed near the bottom of the pop-up menu.
- In the Configure Tooling Model Generation Properties window,
click No to close the window and use the default
tooling model generation properties. Note: If you click Yes, you can modify settings to avoid generating menus, palettes and so on. However, because the goal of the tutorial is to generate menus and palettes, click No. You can return and explore the available properties at a later time.
- In the Project Explorer view, under
the Models package, expand the My
Profile tooling model to see all the tooling elements
as shown in the following figure below.
- If you do not want to customize any profile tooling, you can generate the profile tooling code now. To generate the profile tooling code, in the Project Explorer view, right-click the My Profile tooling model (when open, the full name displays as <<ToolingModel, EditHelpers, Figures, L10N, Providers, Utils>> My Profile); then click Generate Tooling Code. After you generate the tooling code, the src package of the project will contain many packages of generated profile tooling code.
- To see the generated tooling code in action, test the plug-in. In the Project Explorer view, double-click the plugin.xml file and select the Overview tab at the bottom of the diagram editor. Click the Launch an Eclipse application link. This action creates a runtime environment with the new Profile Tooling plug-in loaded. Next, you can create a new UML model based on the profile and test the profile tooling.
Feedback