Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Read out Genmodel file
Read out Genmodel file [message #1808552] Wed, 26 June 2019 17:37 Go to next message
Dimg Cim is currently offline Dimg CimFriend
Messages: 59
Registered: December 2015
Member
Hello, everybody,

there's a way to get all the information from GenModel, even better Xcore Model. I am currently writing a plug-in that renders EMF Model. There I hand over the {Model}Factory, {Model}Package, {Model}ItemAdapterFactory, etc. every time.

I have to set these classes each time for certain XMI files. To make everything generic, I want to set it using GenModel/ XCore Model.

Unfortunately I didn't find anything. In itself it has to work, right? There are some frameworks that use this approach, e.g. Genmodel to Xcore, GenModel to Xtext, etc.

I know there are, but where do I get into the code?

Many greetings
lam
Re: Read out Genmodel file [message #1808569 is a reply to message #1808552] Thu, 27 June 2019 02:19 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
I'm not sure why you'd need to do all these things, i.e., hand over specific classes? What information does the GenModel contain that you'd actually need? Normally I'd expect you'd just need to "hand over" the EPackage instance. After all, the whole framework is base on high-level reflection support such that all the downstream frameworks work properly even for dynamic models for which there is no GenModel and for which no specialized classes are generated.

Of course can can load a *.genmodel in exactly the same way you load any other resource with EMF, i.e., resourceSet.getResource(genModelURI, true), and then the root object in resource.getContents() will be a org.eclipse.emf.codegen.ecore.genmodel.GenModel. It's generally important when loading GenModels to initialize the resource set like this:
resourceSet.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));

The method org.eclipse.emf.ecore.plugin.EcorePlugin.getEPackageNsURIToGenModelLocationMap(boolean) is useful for finding an EPackage's corresponding GenModel (if it has one).


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Extra getPackage in model generation
Next Topic:Nullify string field after deleting its value
Goto Forum:
  


Current Time: Fri Mar 29 14:32:06 GMT 2024

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

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

Back to the top