Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 15:33 Go to next message
Yu Sun is currently offline Yu SunFriend
Messages: 58
Registered: July 2009
Member
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 15:47 Go to previous messageGo to next message
MaximeLecourt  is currently offline MaximeLecourt Friend
Messages: 108
Registered: February 2010
Location: France
Senior Member
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.


One day I shall master M2T, but that day has yet to come...
Re: [Xpand] Can Xpand process two input models together? [message #521478 is a reply to message #521444] Wed, 17 March 2010 17:30 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14722
Registered: July 2009
Senior Member
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


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Previous Topic:Acceleo graduation and version jumping
Next Topic:[Xpand] Affectation problem
Goto Forum:
  


Current Time: Fri Oct 11 16:14:38 GMT 2024

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

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

Back to the top