Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336959 - Add tool to convert between dynamic/static EMF models
Summary: Add tool to convert between dynamic/static EMF models
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: Tools (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-11 11:19 EST by Glenview Jeff CLA
Modified: 2013-07-10 11:25 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Glenview Jeff CLA 2011-02-11 11:19:16 EST
Build Identifier: M20100909-0800

On several occasions, I've wanted to convert to/from dynamic XMI models.

I have two choices, one is I can generate a new editor after making metamodel changes and then start a new Eclipse session with the newly generated plugin.  Alternately, if I want to quickly test out the metamodel changes, I can use the sample reflective ecore model editor.

When using the sample reflective ecore model editor, it requires more information about the location of the meta-model files (in the second line of the XMI file.)

At the least, it would be nice to have a tool to convert from generated editor model to one that indicates the location of the meta-model files so I don't have to do this by hand.  I'm not sure that once this is done I can go back and open the XMI file in the generated editor.  If the XMI file is not compatible the other direction (back to the generated editor,) I'd like to see a command to convert back to the generated editor's format.  

If it isn't compatible in the XMI->generated editor direction, I'd like to see this happen if possible.

Thanks and I hope my explanation was clear.


Reproducible: Always
Comment 1 Ed Merks CLA 2011-02-11 20:50:22 EST
The backlog of wish-list items continues to grow.  Something like this is unlikely ever make it to the top of that list...

It's already easy to serialize an xsi:schemaLocation for your generated model

http://wiki.eclipse.org/index.php/EMF/FAQ#How_can_I_ensure_that_an_xsi:schemaLocation_is_serialized_for_my_packages.3F

And it would be quite easy to do that optionally in your generated editor.   Isn't that enough?
Comment 2 Glenview Jeff CLA 2011-02-15 18:12:16 EST
Ed:  

Thanks very much for your response.

I hadn't seen that FAQ but will take a look at the entire page.  I'm sure you can tell I'm an EMF newbie.  It's not clear to me what it means to serialize the schemaLocation.  

I initially added a couple of the meta-models by creating a fresh model that instantiated a few (not all, there are ~50) of the types in the dynamic editor.  I manually copied the schema locations in fresh XMI file to the real model I want to migrate to work in the dynamic editor.  It seems that after opening up the real model in the dynamic editor, it must have updated the schema for the other types because the reported problems in the dynamic editor seemed to disappear.

Also, I did notice that after I manually modified the XMI file to specify the schema location to work in the dynamic editor, the modified XMI appeared to load in the generated editor in the spawned Eclipse without any issue.  

Thanks!
Jeff
Comment 3 Ed Merks CLA 2013-01-10 06:24:29 EST
I added support so that in the reflective editor, when it can't find a package it tries to determine a location by looking for the registered models (in the plugin.xml) in the target platform, and uses the model for loading the instances. This means that you should be able to reflectively edit instances that have no schema location when there is a generated model for it in the workspace or target platform.  Of course if there is a generated model actually available, that's uses as normal (and as you noticed, the schema location is ignored in that case), so you can use the dynamically edited instance in the generated editor already.

The following change is committed to master:

http://git.eclipse.org/c/emf/org.eclipse.emf.git/commit/?id=23c1ef3724c292003138d7ace7128ffe0fa5d3b9
Comment 4 Ed Merks CLA 2013-07-10 11:25:20 EDT
The changes are available in Kepler.