Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Separate Projects for .genmodel and .ecore
Separate Projects for .genmodel and .ecore [message #1760537] Fri, 28 April 2017 07:41 Go to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
Hi,

I am looking at a project where .genmodel and .ecore are in two separate eclipse plug-ins. The genmodel references the elements in the .ecore with relative uris ../ecoreproject/bla.ecore#..

I wonder if that is actually supported by EMF Tooling, because here's the issue: When I press 'reload' on the genmodel file and follow through the wizard, the .ecore file is _copied_ into the genmodel project and all references in the .genmodel now point to the copy. This isn't of course what I expected. Is this behavior intended, is it just an unsupported case by the wizard/importer? Anything I can do to keep referencing the 'original' ecore file and avoid the copy?


Thanks,
Felix

Re: Separate Projects for .genmodel and .ecore [message #1760540 is a reply to message #1760537] Fri, 28 April 2017 07:59 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
The Reload... action is like running the New EMF Generator wizard again and that's just what that wizard does. It reloads the "foreignModel" (which you won't see in the properties view but you can see in the XMI of the *.genmodel), and exports it to the file name shown in the wizard, which is always in the same folder as the GenModel. So yes, I would expect that behavior.

Why do you need to reload the model? Why is it in a separate project? Note that the GenModel automatically reconciles against the loaded *.ecore when you open the Generator editor, so you shouldn't generally need to Reload... I know it's just a nice thing to do to update the serialization of the *.genmodel so that the serialization is already in sync, but a hack to accomplish that is just to change some property twice, and then save the reconciled GenModel's state.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Separate Projects for .genmodel and .ecore [message #1760548 is a reply to message #1760540] Fri, 28 April 2017 08:28 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
Ed, this is the perfect answer. Still some comments:

Ed Merks wrote on Fri, 28 April 2017 07:59

Why do you need to reload the model?

I always wondered too... and too lazy to investigate. It has never been too clear to me if/when I need to do the reload thing, so I just always did. I think I have been a reload power user since my first EMF model back in 2006 Laughing

Ed Merks wrote on Fri, 28 April 2017 07:59

Why is it in a separate project?

This is EGF/Kitalpha/Polarsys stuff. It was once explained to me that it is to support a 'classic' and a 'cdo' generation while using the same ecore model, so I think they have one cdo.genmodel project and one classic.genmodel project which both point to the same ecore project. The CDO part is closed source, so I cannot see the whole picture.

Again, perfect answer for me. Thank you!
Re: Separate Projects for .genmodel and .ecore [message #1760559 is a reply to message #1760548] Fri, 28 April 2017 10:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Reload is generally a good idea. Often one forgets because it's not totally necessary, and then you make some other change to the GenModel and see a whole bunch of changes. Wow, 2006, I'm getting old. Razz

I see, yes, multiple GenModels make sense of course for such a case. You don't want a copy of the Ecore model.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Separate Projects for .genmodel and .ecore [message #1760754 is a reply to message #1760559] Tue, 02 May 2017 15:57 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
I found an actual problem with this separate project approach: When I "Load Resource" in the Ecore Editor and "Browse Target Platform Packages...", I cannot load packages where the .ecore is not in the same project as the genmodel. I think it is because the resource uri map only includes entries for plugins that include genmodels. Normally, ecore and genmodel are in the same plugin, so this works. However, if the .ecore is in a different plugin a separate uri mapping is needed.
Re: Separate Projects for .genmodel and .ecore [message #1760796 is a reply to message #1760754] Wed, 03 May 2017 06:23 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
That doesn't sound unlikely. So likely it would be better if the one *.ecore/*.genmodel pair exists in the "normal" project and the second pair lived in the alternative project (and Reload... was used to keep the second *.ecore in sync with the first.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Separate Projects for .genmodel and .ecore [message #1760812 is a reply to message #1760796] Wed, 03 May 2017 08:42 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

This seems related to a problem I have finding an irregular *.ecore file from its nsURI.

Perhaps the org.eclipse.emf.ecore.generated_package extension point should allow an explicit specification of the *.ecore file(s) location. Auto-generated org.eclipse.emf.ecore.generated_package could specify it/them anyway to avoid needing to either deduce it/them either as siblings of the *.genmodel specification, or by analyzing the genmodel content to find the *.ecore file(s).

Regards

Ed Willink
Re: Separate Projects for .genmodel and .ecore [message #1760830 is a reply to message #1760812] Wed, 03 May 2017 12:38 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
This is definitely the same problem Ed W. Maybe continue talk on an enhancement bugzilla. I really want to fix this somehow.
Re: Separate Projects for .genmodel and .ecore [message #1760916 is a reply to message #1760830] Thu, 04 May 2017 10:21 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
I have created https://bugs.eclipse.org/bugs/show_bug.cgi?id=516164
Previous Topic:Missing references
Next Topic:Validation error while data binding
Goto Forum:
  


Current Time: Tue Apr 16 04:42:17 GMT 2024

Powered by FUDForum. Page generated in 0.13881 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top