Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [xpand] polymorphism with templates spread over multiple files
[xpand] polymorphism with templates spread over multiple files [message #549604] Tue, 27 July 2010 07:02 Go to next message
Marten Sijtema is currently offline Marten Sijtema
Messages: 67
Registered: November 2009
Member
Hello,

In my metamodel i have an element 'View' and some subtypes viewA and viewB. ViewB and A are in different xpt files, in same namespace. I would like to expand these definitions polymorphically:
<expand v foreach View>


Ie. When an element is of type viewA , the viewA define block is expanded, etc.

This works when all the define blocks are in the same file. I want to put them in separate files, but then it doemst work, ie. always the supertype is called. How should i do this?


My company: Sytematic, building business software from models.
Re: [xpand] polymorphism with templates spread over multiple files [message #549620 is a reply to message #549604] Tue, 27 July 2010 07:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6143
Registered: July 2009
Senior Member
Hi,

hi, i fear the is no nice way but
the easiest way would be to add some dispatcher-defines to the template

<<DEFINE main FOR model>>
    <<EXPAND main FOEACH elements>>
<<ENDDEFINE>>

<<DEFINE main FOR A>>
   <<EXPAND fileA::main FOR this>>
<<ENDDEFINE>>

<<DEFINE main FOR B>>
    <<EXPAND fileB::main FOR this>>
<<ENDDEFINE>>

<<DEFINE main FOR C>>
    <<EXPAND fileC::main FOR this>>
<<ENDDEFINE>>


Regards
Christian

[Updated on: Tue, 27 July 2010 07:46]

Report message to a moderator

Re: [xpand] polymorphism with templates spread over multiple files [message #549625 is a reply to message #549604] Tue, 27 July 2010 08:01 Go to previous message
Marten Sijtema is currently offline Marten Sijtema
Messages: 67
Registered: November 2009
Member
Hm, that solution also crossed my mind. Ill go for that, but don't think it is elegant Smile

Ideally the definitions from the same package should be visible...


My company: Sytematic, building business software from models.
Previous Topic:MTL Escape Characters
Next Topic:[xpand] how to refer to an external metamodel ?
Goto Forum:
  


Current Time: Thu Jul 31 03:35:56 EDT 2014

Powered by FUDForum. Page generated in 0.02551 seconds