EMF Profile Definition

Aus SDQ-Wiki
Warning
The most important information of this page was moved to the GitHub ReadMe

Using the EMF Profiles Sirius Editor

  • Install the graphical editor from the site
  • Create a new EMF Profiles (Sirius) project
  • Navigate to and open the EMF Profiles diagram
  • If the meta models that you want to use within your profile is NOT installed in your Eclipse instance consider
    • starting an inner Eclipse instance (effect: meta models are installed in the inner instance)
    • import your profiles project
    • edit your profile in the inner Eclipse instance
    • when finished: close inner instance and refresh profiles project in outer Eclipse instance (do NOT try to edit profile in outer instance)

At this step, you can import classes using the "Import EClass" tool, create stereotypes, make them extend and reference classes and create tagged values. The "Display referenced and extended EClasses" tool can be used in case a stereotype extends or references a class but the class is not shown in the diagram. This can be useful when dealing with old EMF Profiles. The created profile can be directly used in the same Eclipse instance. Use the "Registered EMF Profiles" view to make sure that the profile has been registered.

Using the old graphical editor

To create and use a profile you have to perform the following steps:

Create an empty profile

  • Create a new EMF Profile Project
    • "New - Project - EMF Profile Project"
    • Set up the right name, namespace prefix and namespace URI
      • The name of the profile cannot contain whitespaces!
      • The namespace prefix should be of the form "tld.domain.whatever.profilename"
      • The namsepace URI has to contain a third slash and should be of the form "http://tld.domain/somethingAfterAThirdSlash"
  • Create the folder "META-INF" in your project
  • Create a new file "MANIFEST.MF" in the "META-INF" folder
  • Add the following to your manifest: (the empty line at the end is there on purpose)
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MyProfile (insert plugin name here)
Bundle-SymbolicName: edu.kit.ipd.sdq.myprofile; singleton:=true (insert fully qualified plugin name here)
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8

  • Close and reopen the manifest. Now the plugin configuration should have opened. Open the Dependencies tab
    • add "org.modelversioning.emfprofile" and "org.modelversioning.emfprofile.registry" to the list of required bundles
    • add all plug-ins of the metamodels to which stereotypes shall be applied to the list of required bundles

Modify the profile

  • It is strongly advised, that you use the new Sirius-based Profile editor. The remainder of this section is partially outdated. (will be updated soon)
  • take care: there is a bug in the editor: if you cannot import existing metaclasses after closing the editor you have to initialize a new diagram and delete it to fix the original profile diagram
  • Modify the created profile diagram using the "EMF Profile Diagram Editor"
    • Import every metaclass that shall be extended before creating any stereotypes!
      • (we suspect that only metamodel, that are installed in the platform can be references, not the ones that are located in the workspace)
    • A detailed description and an example is provided by the developers of EMF Profiles: http://me-at-big.blogspot.co.at/2013/04/how-to-create-emf-profile.html
  • take care: using the delete key removes elements only from the diagram and not from the profile model (which is stored in the same file)
    • Either use "Delete from Model" from the context menu or use a text editor to remove the unwanted elements

Remarks

  • Profiles can not be used to extend eClasses by containments (only extension by references).
  • Further, the stereotype mechanism should only be used to create links between meta models. All required meta model elements should be created upfront.
  • When trying to test/apply profiles in the same instance where they are specified, it causes problems if multiple diagram files with the same name exist (e.g. in separate plugins).