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 10:56 Go to next message
MaximeLecourt  is currently offline MaximeLecourt
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 10: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 04:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6131
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
Re: Using either globalvardef or property in both workflow and Xpand [message #522299 is a reply to message #521991] Mon, 22 March 2010 04:10 Go to previous messageGo to next message
MaximeLecourt  is currently offline MaximeLecourt
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 09:41 Go to previous messageGo to next message
Edin - is currently offline Edin -
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 10:14 Go to previous message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6131
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
Previous Topic:[ACCELEO] Compiling multi-plugin project using maven
Next Topic:Only one file for many classes, here my code.
Goto Forum:
  


Current Time: Fri Jul 25 21:08:24 EDT 2014

Powered by FUDForum. Page generated in 0.02317 seconds