Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Dynamic Browsing and Instantiation Capabilites in EMF"

(Dynamic Browsing and Instantiation of EMF Models using EMF Reflective Editors)
 
Line 9: Line 9:
 
<p>Step 1. Create an Empty EMF Project.<br>
 
<p>Step 1. Create an Empty EMF Project.<br>
 
Step 2. Create an Ecore using the Example EMF Model Creation Wizards > Ecore Model<br>
 
Step 2. Create an Ecore using the Example EMF Model Creation Wizards > Ecore Model<br>
 +
<pre>
 
         The Ecore editor would open with the package as null.
 
         The Ecore editor would open with the package as null.
 
         Double Click on the package:null to update the Name and NsURI Property.
 
         Double Click on the package:null to update the Name and NsURI Property.
 
               NsURI should be assigned the resource path where the ecore is found.
 
               NsURI should be assigned the resource path where the ecore is found.
 
               For e.g. /resource/<Plugin Name>/<Folder Name>/<Ecore Name>.ecore
 
               For e.g. /resource/<Plugin Name>/<Folder Name>/<Ecore Name>.ecore
Step 3. Update the Ecore to represent your model.
 
 
<pre>
 
For e.g.
 
My ecore looks like
 
         
 
       
 
 
 
</pre>
 
</pre>
 +
Step 3. Update the Ecore to represent your model.
 +
Step 4. Once the ecore is updated, Right Click on the RootObject of your model that you would want to instantiate and select Create Dynamic Instance... available after Validate

Revision as of 09:45, 7 February 2007

Introduction

EMF provides a reflective editor, which can view and edit any EMF model file, using only the model meta-data. It provides similar function to the default generated editor, but it can't be easily customized.

In this short write up I have tried to pen down the steps involved for using this reflective editor which is quiet a hidden feature in EMF.


Using the Reflective Editor – an Example

Step 1. Create an Empty EMF Project.
Step 2. Create an Ecore using the Example EMF Model Creation Wizards > Ecore Model

        The Ecore editor would open with the package as null.
        Double Click on the package:null to update the Name and NsURI Property.
               NsURI should be assigned the resource path where the ecore is found.
               For e.g. /resource/<Plugin Name>/<Folder Name>/<Ecore Name>.ecore

Step 3. Update the Ecore to represent your model.

Step 4. Once the ecore is updated, Right Click on the RootObject of your model that you would want to instantiate and select Create Dynamic Instance... available after Validate

Back to the top