Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » [Xpand] Can Xpand process two input models together?
[Xpand] Can Xpand process two input models together? [message #521438] Wed, 17 March 2010 11:33 Go to next message
Eclipse UserFriend
Hi everyone,

I currently have a Xpand template to generate code for one model, and it works.

However, I want to have another input model (different domain) to generate something else in the same file (aspect-oriented might not work well at this point), therefore, I have another import statement:

import Metamodel1;
import Metamodel2;
...

However, I do not know how to access and trigger the elements in the 2nd metamodel. For example:

<<DEFINE d1 FOR Metamodel1::Element1>>
void function1()
{
somestatement;
somestatement;

<<EXPAND d2 FOR ???>> // The problem is I do not know how to put the target here. How can I access the second model?

}
<<ENDDEFINE>>


<<DEFINE d2 FOR Metamodel2::Element1>>
... ...
<<ENDDEFINE>>

Any idea? Is it doable?

Also, a related question is: is there any statement in Xpand or Xpand extension that can get all instances of a certain type of elements directly without using a container?

Thanks a lot.

Yu
Re: [Xpand] Can Xpand process two input models together? [message #521444 is a reply to message #521438] Wed, 17 March 2010 11:47 Go to previous messageGo to next message
Eclipse UserFriend
To get all instances of a certain type, you have to use Xtend
http://www.eclipse.org/forums/index.php?t=msg&th=163923& amp;start=0&
Look at the last messages.
Re: [Xpand] Can Xpand process two input models together? [message #521478 is a reply to message #521444] Wed, 17 March 2010 13:30 Go to previous message
Eclipse UserFriend
another possibility is to pass both to your define

«DEFINE definionName(OtherType otherType) FOR Type»
«ENDDEFINE»


then you can access the second model using the variable otherType
Previous Topic:Acceleo graduation and version jumping
Next Topic:[Xpand] Affectation problem
Goto Forum:
  


Current Time: Sat Aug 30 21:41:29 EDT 2025

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

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

Back to the top