# 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:

- 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 Profileprofile has been applied on it and the EPackagestreotype's nsUri property has been set to http://www.mycompany.com/MyLanguage/1 .

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

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

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

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.

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

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

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.

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.

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

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.

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

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