EMF Modelling in Eclipse

Posted by on Jul 6, 2012 in Blog, Technical | 0 comments

Installation

In Eclipse Update manager select “Modeling -> EMF-Eclipse Modeling Framework SDK” and “Modeling -> Ecore Tools”.

Create Emf Model

File / New / Project / Eclipse Modeling Framework / Empty EMF project

Create Ecore Diagram

  1. File / New / Other / Ecore Tools / Ecore Diagram
  2. Name your “Domain File Name”
  3. Click on Eclass and click into the editor to create new class
  4. Click Eattribute to assign each object the attributes
  5. Select Ereferences to create reference between objects

View Ecore diagram

Close the dialog and open the file “name.ecore”

Create EMF Generator Model

  1. Select “name.ecore”
  2. New / Other / Eclipse Modeling Framework / EMF Generator Model
  3. In Select a Model Importer -> Select “Ecore model”
  4. Select your model and press load

Set the package

Right-click on the root node of the genmodel and select “Generate Model Code” This will create the java implementation of the EMF model in project.

 

Leave a Reply

Your email address will not be published. Required fields are marked *