Use the Omondo Profile Example


Omondo profile is built on top of both UML2 Profile and Eclipse extension mechanism. Omondo profile allows implementors to add custom ihms to diagram element properties dialogs, as well as actions to the element popup menus depending on the stereotypes set on the element. Thus, implementors can plug their own frameworks into the UML diagrams.


Step 1: Applying the sample Profile to the project
Step 2: Applying the new stereotype

on new classes
on existing classes
on associations

Step 3: Using the new actions in element popup menus



Applying the Sample Profile on the project


Switch to Java Perspective by selecting Window in the main menubar > Open Perspective > Java.

 


We consider that you have successfully created a java project (e.g. tutorial), a src folder and package (e.g.tutorial). Select your project in the Package Explorer > open the popup menu > Properties.


 
 

Select Omondo Profiles in the left pane and check Example Profile. The Omondo Profile is activated as soon as you click on the OK button.

 


The Omondo Profiles are based on a UML2 profile to define the stereotypes that may be used in the diagrams. So activating an Omondo Profile on a project will apply the associated UML2 profile to the project too. Select UML Profiles in the left pane and check that the Example Profile is in the list. (The association to the UML profile comes from information in the descriptor file, have a look to this section to get more information)




Applying the new stereotype to new classes

Create a new class by selecting the Create a Class green icon in the class diagram toolbar > Drag the selected element to the diagram editor > Drop at the place where you want the class be created.


 

In the first page of the wizard, edit the Name field (e.g. Employees) and click on the next button.


 

Click on the New Stereotype button.


 

Use the arrow to scroll the available stereotypes and select the stereotype defined in the associated UML2 profile which is labeled Example::MyStereotype.

Note that all available stereotypes come from the UML profiles applied to the project.


 

Select the stereotype attribute and add a value by clicking on the Edit button.


 

Edit the Value field and click on the OK button.


 

The UML properties are displayed in the New Java Class wizard. Click on the Finish button.

 

Note that the class Employee and its stereotype have been created inside the class diagram editor.




Applying the new stereotype to existing classes

Select the Create a class icon in the class diagram toolbar and drag the link to the contextual menu, edit the Name field (e.g. Company) and click on the finish button.


 
Right click on Company class inside the class diagram to open the popup menu > Properties.


 

In the first tab of the dialog, select the New Stereotype button.


 

Scroll the available stereotypes.


 

Select "Example::MyStereotype" stereotype in the Stereotype field.


 

Note that a new tab labeled Example Example::MyStereotype appears in the Class properties dialog. The content of this tab is defined by the sample Omondo Profile. Implementors have acces to the metamodel to fill the controls of this tab (for the purpose of this tutorial, this tab has no controls).




Applying the new stereotype to associations

Selecting the Association icon from the class diagram toolbar.




Click the left mouse button on the Employee class element and drag the link from the Employee Class to the Company class. Drop when the Company class is highlighted.

 

Select the Properties tab and add a new stereotype by clicking on New Stereotype button.


 

Use the arrow to scroll the available stereotypes and select Example::MyStereotype. Click on the OK button to return to the properties dialog.

 

Note that the Example::Mystereotype stereotype has been added to the stereotype list and the new tab labeled Example Example::MyStereotype. It is possible to change the stereotype attribute value by using the Edit button.

 

Add a new value (e.g. another value) and click on the OK button to return to the properties dialog.


 

Note that the Properties tab has been updated and includes the new stereotype attribute value. Click on the OK button to perform the changes.




Note that stereotypes have been added to Employee and Company classes, and also to the association. In the same way, you can add stereotypes to other types of elements such as methods, attributes, dependencies, etc...







Using the new actions in element popup menus


Omondo Profile extension mechanism allows implementors to add new action items into diagram popup menus. The sample profile adds some dummy actions to the element popup menu. (see the code review)

To unselect an element, click on the left mouse button and select the background of the class diagram > right click > open the popup menu > Example Profile > Example Action.


 

An information dialog appears and shows the name of the UML2 element associated with this diagram (i.e the package named tutorial).

 


Select the Employee class,  open the popup menu > Examle Profile > Example action.

 

An information dialog appears and shows the attribute names of the applied stereotype and its value. 


 

 Select the association  open the popup menu > Example Profile > Example action.

 

An information dialog appears and shows the attribute names of the applied stereotype and its value. 


 

We have successfully customized our class diagram by adding new tabs to the element properties dialog and a new action to the element popup menu. More ambitious customization can be performed while working at code level. See the code review chapter.





 
Last update Mon Feb 02 16:22:01 CEST 2005 Valid XHTML 1.0 Valid CSS All text, graphics © 2002-2005 by Omondo