Skip to main content



      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
Eclipse UserFriend
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?
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
Eclipse UserFriend
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] by 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
Eclipse UserFriend
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...
Previous Topic:MTL Escape Characters
Next Topic:[xpand] how to refer to an external metamodel ?
Goto Forum:
  


Current Time: Tue Jul 08 08:30:23 EDT 2025

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

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

Back to the top