Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f15add2dd8e669b594ff5e2c7bedd6b7d4ace22a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
= Generating Static Profiles =

:'''Contents'''
__TOC__

This article shows how to generate static UML profiles from dynamic UML profiles.

== Before Starting... ==

Make sure that the following plug-ins are installed:
* EMF - Eclipse Modeling Framework SDK
* UML2 Extender SDK

In the following, it is assumed that a (dynamic) UML profile named '''mylanguage''' has already been defined, the '''Ecore Profile'''profile has been applied on it and the '''EPackage'''streotype's '''nsUri''' property has been set to '''http://www.mycompany.com/MyLanguage/1'''.

[[Image:images/beforeStarting.png|The MyLanguage UML Profile]]<br>

== Generating an EMF Generator Model ==

To generate the static profile, first a new EMF Generator Model should be generated. 

Select '''File -> New -> Other… -> Eclipse Modeling Framework -> EMF Generator Model'''. When the '''EMF Generator Model''' dialog appears, select a parent folder and enter a file name for the generator model with an extension '''mylanguage.profile.genmodel''' and click '''Next>'''.

[[Image:images/newEMFGeneratorModel.png|EMF Generator Model]]<br>

When the '''Select a Model Importer''' dialog appears, select '''UML Model''' from the list and click '''Next>'''.

[[Image:images/selectAModelImporter.png|Select a Model Importer]]<br>

When the '''UML Import''' dialog appears, browse the '''.uml''' file of the profile, click '''OK''' in case a warning message dialog appears and then click '''Next>'''.

[[Image:images/umlImport.png|UML Import]]<br>

When the '''Package Selection''' dialog appears, firstly select all models from the '''Reference ''' list (down), then select the '''RootElement''' package from the '''RootPackages'''  list (above) and click '''Finish'''.

[[Image:images/packageSelection.png|Package Selection]]<br>

The generated '''mylanguage.profile.genmodel''' file will open and appear automatically in the editor.

[[Image:images/generatedGenmodelFile.png|The Generated genmodel File]]<br>
	

== Generating the Static Profile ==
	
To generate the static profile, from the generated '''.genmodel''' file select the root element and go to the '''Properties''' view.

From the '''Properties''' view, find the '''Model -> Model Directory''' property and modify it from '''…/src''' to '''…/src-gen''' and save the modifications.

Then go back to the generated '''mylanguage.profile.genmodel''' file,	right click on the root element and select the '''Generate Model Code''' menu item.

The generated files can be found in the '''…/src-gen''' folder.


== Regenerating an existing Static Profile ==
	
Find and open to the generated '''mylanguage.profile.genmodel''' file, right click on the root element and select the '''Reload…''' menu item.

When the '''Reload''' dialog appears, click '''Next>''', click '''Next>''' until the '''Finish''' button appers and then click '''Finish'''.

Go to the '''…/src-gen''' folder and delete all previously generated files.

Then go back to the generated '''mylanguage.profile.genmodel''' file,	right click on the root element and select the '''Generate Model Code''' menu item.

The regenerated files can be found in the '''…/src-gen''' folder.

== Registering the Generated Static Profile ==

Open the '''MANIFEST.MF''' file, go to the '''Extensions''' tab, click on the autogenerated '''org.eclipse.emf.ecore.generated_package''' extension to see its element details. Note that the '''uri'''property is as defined in the '''EPackage''' stereotype ('''http://www.mycompany.com/MyLanguage/1''').

[[Image:images/extensionEMFGeneratedPackage1.png|The Autogenerated generated_package Extension]]<br>

Add an '''org.eclipse.emf.ecore.uri_mapping''' extension and set its '''source''' (the relative path to the profile) and '''target''' (the absolute path to the profile) properties.

[[Image:images/uriMapping.png|The Ecore Uri Mapping Extension]]<br> 

Then add an '''org.eclipse.uml2.uml.generated_package''' extension and set its '''uri''' (the uri of the profile as before) and '''location''' (the location to the xmi id of the profile) properties.

[[Image:images/umlGeneratedPackage.png|The UML Generated Package Extension]]<br> 

Lastly, add a '''org.eclipse.papyrus.uml.extensionpoints''' dependency from the '''Dependencies''' tab.

[[Image:images/addUMLExtensionpointDependency.png|The UML Extension Points Dependency]]<br> 

And then, go back to the '''Extensions''' tab, add an '''org.eclipse.papyrus.uml.extensionpoints.UMLProfile''' extension and set its '''name''', '''path''', '''description''' and '''provider''' properties.

[[Image:images/papyrusUMLProfile.png|The Papyrus UML Profile Extension]]<br> 


To test if the static profile registered successfully, open an '''Apply Registered Profile'''dialog and check if the '''MYLANGUAGE''' profile exists in the list.

[[Image:images/applyRegisteredProfile.png|Apply Registered Profile]]<br> 

<hr/>
''Tested on Papyrus 2.0 on Eclipse 4.6 RC1''<br>
''Last updated: May 20, 2016 by Önder Gürcan <[mailto:onder.gurcan@cea.fr onder.gurcan@cea.fr]>'' 

Back to the top