Skip to main content


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 11:02 Go to next message
Marten Sijtema is currently offline Marten SijtemaFriend
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 11:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
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


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 27 July 2010 11: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 12:01 Go to previous message
Marten Sijtema is currently offline Marten SijtemaFriend
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: Tue Apr 23 10:24:39 GMT 2024

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

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

Back to the top