Difference between revisions of "MDT-UML2Tools How To Use UML Profiles"

From Eclipsepedia

Jump to: navigation, search
m
 
(17 intermediate revisions by one user not shown)
Line 9: Line 9:
 
==Create Profile==
 
==Create Profile==
 
=== Create Profile Definition Diagram ===
 
=== Create Profile Definition Diagram ===
First, create Profile Definition Diagram using wizard 'Profile Definition Diagram' from 'UML 2.1 Diagrams' located in File > New > Other > ... menu item.
+
First, create Profile Definition Diagram using wizard 'Profile Definition Diagram' from 'UML 2.1 Diagrams' located in File > New > Other > ... menu item.<br>
Profile is a root element of the created diagram.
+
Profile is a root element of the created diagram.<br>
 
Key elements of Profile Definition diagram are:
 
Key elements of Profile Definition diagram are:
 
* Profile
 
* Profile
Line 16: Line 16:
 
* Metaclass
 
* Metaclass
 
* Extension link
 
* Extension link
[[Image:18.10_Defining_a_simple_EJB_profile.gif]]
+
[[Image:18.10_Defining_a_simple_EJB_profile.gif]]<br>
 +
Zipped diagram is [http://wiki.eclipse.org/images/f/f5/SampleProfileD.zip here]
  
 
=== Define Profile ===  
 
=== Define Profile ===  
When profile is completely finished, it's time to define it. This is obligatory step in our workflow, because it saves defined profile as a static Ecore structure in UML model, it allows subsequent use of profile content. In order to define a profile in UML2 Tools call action "Profile > Define" from the context menu of the profile diagram:
+
When profile is completely finished, it's time to define it. This is obligatory step in our workflow, because it saves defined profile as a static Ecore structure in the UML model, it allows subsequent use of profile content. <br>
 
+
In order to define a profile in UML2 Tools call action "Profile > Define" from the context menu of the profile diagram:<br>
 +
[[Image:DefineProfileAction.jpg]]<br>
 
=== Register Profile===
 
=== Register Profile===
Adding profile to the registry simplifies profile application later. The step can be omitted.  
+
Adding profile to the registry simplifies profile application later. The step can be omitted. <br>
Profiles are registered in plugin descriptor (plugin.xml file) using 'org.eclipse.uml2.uml.dynamic_package' extension point.
+
Profiles are registered in plugin descriptor (plugin.xml file) using 'org.eclipse.uml2.uml.dynamic_package' extension point. The plugin should be deployed to the platform later.<br>
 
For example, UML Standard profile is registered this way:
 
For example, UML Standard profile is registered this way:
 +
<source lang="xml">
 
   <extension
 
   <extension
 
     point="org.eclipse.uml2.uml.dynamic_package">
 
     point="org.eclipse.uml2.uml.dynamic_package">
     <profile uri="http://www.eclipse.org/uml2/schemas/Ecore/5" location="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
+
     <profile uri="http://www.eclipse.org/uml2/schemas/Ecore/5" location="platform:/plugin/org.eclipse.uml2.uml.resources/profiles/Ecore.profile.uml#_0"/>
 
   </extension>
 
   </extension>
 
+
</source>
 
==Use Profile==
 
==Use Profile==
 
=== Apply Profile ===
 
=== Apply Profile ===
 +
In order to allow to apply the stereotypes defined in the profile to elements in the model, profile should be applied. <br>
 +
To Apply profile call 'Apply Profile> [Profile Name]' action from the context menu of the diagram:<br>
 +
[[Image:ApplyProfile.jpg]]<br>
 +
What profiles appears in the drop-down list in the 'Apply Profile' action? Only those profiles that had been registered (see [[#Register Profile]]) or profiles from loaded resources(see [[#Load resource]]). To make the particular profile appear in the list, register it or load corresponding *.profile.uml resource.
 +
==== Load resource ====
 +
In order to load resource defining profile:
 +
# Call 'Load resource...' action from the context menu of the diagram.
 +
# In the displayed wizard choose 'Browse Workspace...' button.
 +
# Choose needed resource, file containing profile ends with 'profile.uml' :<br>
 +
[[Image:LoadResource.jpg]]<br>
 
=== Apply Stereotype ===
 
=== Apply Stereotype ===
 +
The final step in creating extended element is applying a stereotype. Stereotypes can be applied to both nodes and links. Create an element of the extended metaclass, in the context menu of the newly-created element call 'ApplyStereotype>[name of stereotype]':<br>
 +
[[Image:ApplyStereotype.jpg]]<br>
 +
Now element is extended.<br>
 +
==== Apply stereotype using label in-place editor====
 +
Another way to apply a stereotype is to use stereotype label in-place editor. Select stereotype label and type comma-separated list of stereotypes. Added to the list stereotypes will be applied, if a stereotype was removed from the list, it will be un-applied:<br>
 +
[[Image:ApplyProfile_inplace.jpg]]
 +
=== Extended element===
 +
The extended element is labeled with a name of the applied stereotype in the guillemets:<br>
 +
[[Image:LabeledElement.jpg]]<br>
 +
Tagged values (properties of the applied stereotype) will be shown and editable in the 'Tagged Values' tab of the Properties View:<br>
 +
[[Image:TaggedValues.jpg]]
 +
 +
----
 +
 +
For more information about working with Profile reference [http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Introduction_to_UML2_Profiles/article.html Introduction_to_UML2_Profiles] tutorial.

Latest revision as of 13:23, 12 November 2008

Contents

[edit] Introduction

UML cannot cover needs of all possible domains. Standard UML metamodel has to be augmented in order to meet requirements of a particular domain. That's why Profile mechanism was created - a way to create a lightweight extension of Standard UML.

[edit] Summary

Here is the workflow of creating and using UML profile:

UsingProfile.gif

[edit] Create Profile

[edit] Create Profile Definition Diagram

First, create Profile Definition Diagram using wizard 'Profile Definition Diagram' from 'UML 2.1 Diagrams' located in File > New > Other > ... menu item.
Profile is a root element of the created diagram.
Key elements of Profile Definition diagram are:

  • Profile
  • Stereotype
  • Metaclass
  • Extension link

18.10 Defining a simple EJB profile.gif
Zipped diagram is here

[edit] Define Profile

When profile is completely finished, it's time to define it. This is obligatory step in our workflow, because it saves defined profile as a static Ecore structure in the UML model, it allows subsequent use of profile content.
In order to define a profile in UML2 Tools call action "Profile > Define" from the context menu of the profile diagram:
DefineProfileAction.jpg

[edit] Register Profile

Adding profile to the registry simplifies profile application later. The step can be omitted.
Profiles are registered in plugin descriptor (plugin.xml file) using 'org.eclipse.uml2.uml.dynamic_package' extension point. The plugin should be deployed to the platform later.
For example, UML Standard profile is registered this way:

  <extension
     point="org.eclipse.uml2.uml.dynamic_package">
    <profile uri="http://www.eclipse.org/uml2/schemas/Ecore/5" location="platform:/plugin/org.eclipse.uml2.uml.resources/profiles/Ecore.profile.uml#_0"/>
  </extension>

[edit] Use Profile

[edit] Apply Profile

In order to allow to apply the stereotypes defined in the profile to elements in the model, profile should be applied.
To Apply profile call 'Apply Profile> [Profile Name]' action from the context menu of the diagram:
ApplyProfile.jpg
What profiles appears in the drop-down list in the 'Apply Profile' action? Only those profiles that had been registered (see #Register Profile) or profiles from loaded resources(see #Load resource). To make the particular profile appear in the list, register it or load corresponding *.profile.uml resource.

[edit] Load resource

In order to load resource defining profile:

  1. Call 'Load resource...' action from the context menu of the diagram.
  2. In the displayed wizard choose 'Browse Workspace...' button.
  3. Choose needed resource, file containing profile ends with 'profile.uml' :

LoadResource.jpg

[edit] Apply Stereotype

The final step in creating extended element is applying a stereotype. Stereotypes can be applied to both nodes and links. Create an element of the extended metaclass, in the context menu of the newly-created element call 'ApplyStereotype>[name of stereotype]':
ApplyStereotype.jpg
Now element is extended.

[edit] Apply stereotype using label in-place editor

Another way to apply a stereotype is to use stereotype label in-place editor. Select stereotype label and type comma-separated list of stereotypes. Added to the list stereotypes will be applied, if a stereotype was removed from the list, it will be un-applied:
ApplyProfile inplace.jpg

[edit] Extended element

The extended element is labeled with a name of the applied stereotype in the guillemets:
LabeledElement.jpg
Tagged values (properties of the applied stereotype) will be shown and editable in the 'Tagged Values' tab of the Properties View:
TaggedValues.jpg


For more information about working with Profile reference Introduction_to_UML2_Profiles tutorial.