Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Access metamodel elemnets from model
Access metamodel elemnets from model [message #1287142] Mon, 07 April 2014 08:58 Go to next message
Adnan AL-SOSWA is currently offline Adnan AL-SOSWA
Messages: 41
Registered: May 2010
Member
Hi all ,

I have question if you please ,
I use Xpand language to generate code from model , and I am wondering if it is possible from model Level to access to metamodel components

for example : I have mymetamodel.ecore and I created instance of it model.xmi
now I am trying to make template general for all models that conform to mymetamodel.ecore , is there any way that give me the result that code in red (as it only what I need and not correct) , I do not want to write template to generate template.
«IMPORT [color=darkred]model.metatype.name[/color]»

«DEFINE main FOR ecore::EObject»
«EXPAND autoname FOREACH [color=darkred]this.eAllContents()[/color]-»

«DEFINE autoname FOR  this.metatype.name -»
 [color=darkred]this.metatype.name[/color] [«EXPAND reference FOREACH [color=darkred]this.refrences.name [/color]SEPARATOR ', '»]). 

«ENDDEFINE»

Re: Access metamodel elemnets from model [message #1287326 is a reply to message #1287142] Mon, 07 April 2014 13:15 Go to previous message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6242
Registered: July 2009
Senior Member
Hi am not sure if i get your question but cant you ask an eObject for its eclass?
Previous Topic:Acceleo - Differences between generations runner
Next Topic:How to import ecore2ecore in template?
Goto Forum:
  


Current Time: Mon Sep 01 19:38:31 EDT 2014

Powered by FUDForum. Page generated in 0.01445 seconds