Papyrus Banner

Generating Static Profiles

Contents
  1. Generating Static Profiles
    1. Before Starting...
    2. Generating an EMF Generator Model
    3. Generating the Static Profile
    4. Regenerating an existing Static Profile
    5. Registering the Generated Static Profile

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

Before Starting...

Make sure that the following plug-ins are installed:

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

The MyLanguage UML Profile

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>.

EMF Generator Model

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

Select a Model Importer

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>.

UML Import

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.

Package Selection

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

The Generated genmodel File

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 uriproperty is as defined in the EPackage stereotype ( http://www.mycompany.com/MyLanguage/1 ).

The Autogenerated generated_package Extension

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.

The Ecore Uri Mapping Extension

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.

The UML Generated Package Extension

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

The UML Extension Points Dependency

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.

The Papyrus UML Profile Extension

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

Apply Registered Profile


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