Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Using either globalvardef or property in both workflow and Xpand
Using either globalvardef or property in both workflow and Xpand [message #521991] Fri, 19 March 2010 14:56 Go to next message
MaximeLecourt  is currently offline MaximeLecourt Friend
Messages: 108
Registered: February 2010
Location: France
Senior Member
I want to generate Java code, and packages.

I know how to use a property to create the package when generating.
I know how to use a globalvardef in my XPand template, via Xtend.

But I'd like to use only one value, either a globalvar or a property in both my workflow and my Xpand template (or Xtend).

How can I do that ?

Regards,

Maxime


One day I shall master M2T, but that day has yet to come...

[Updated on: Fri, 19 March 2010 14:56]

Report message to a moderator

Re: Using either globalvardef or property in both workflow and Xpand [message #522118 is a reply to message #521991] Sat, 20 March 2010 08:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
without using globalvar this could look like this

...
<property name="package" value="thepackage" />
...
<expand value="template::Template::main('${package}') FOR model" />


«DEFINE main(String package) FOR Model»
«EXPAND javaClass(package) FOREACH entities()»
«ENDDEFINE»

«DEFINE javaClass(String package) FOR Entity»
	«FILE package+"/"+name+".java"»


using globalvars it would look like

<globalVarDef name="package" value="'thepackage'"/>


«DEFINE javaClass FOR Entity»
	«FILE ((String) GLOBALVAR package)+"/"+name+".java"»


you should find both in the docs


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Using either globalvardef or property in both workflow and Xpand [message #522299 is a reply to message #521991] Mon, 22 March 2010 08:10 Go to previous messageGo to next message
MaximeLecourt  is currently offline MaximeLecourt Friend
Messages: 108
Registered: February 2010
Location: France
Senior Member
Thank you,

Maxime


One day I shall master M2T, but that day has yet to come...
Re: Using either globalvardef or property in both workflow and Xpand [message #780831 is a reply to message #522299] Thu, 19 January 2012 14:41 Go to previous messageGo to next message
Edin - is currently offline Edin -Friend
Messages: 7
Registered: January 2012
Junior Member
How can I assign a value to this global variable? I want to do something like:

..
«FOREACH this.Coordinates AS coordinate»
  	(«this.x»,«this.y»)
  	«GLOBALVAR prevc = coordinate»
«ENDFOREACH»
..


where of course the global variable prevc has been defined in the workflow as

globalVarDef = {
  name = 'prevc'
}
Re: Using either globalvardef or property in both workflow and Xpand [message #780845 is a reply to message #780831] Thu, 19 January 2012 15:14 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

this should be explained here http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.xpand.doc/help/ch01s03.html

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:[ACCELEO] Compiling multi-plugin project using maven
Next Topic:Only one file for many classes, here my code.
Goto Forum:
  


Current Time: Tue Apr 16 17:00:34 GMT 2024

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

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

Back to the top