|Re: [Xpand] setting the value of a global variable from xtend? [message #646709 is a reply to message #646706]
||Thu, 30 December 2010 10:19
|| Lorenzo Bettini
Registered: July 2009
Location: Firenze, Italy
On 12/30/2010 10:54 AM, Lorenzo Bettini wrote:|
> in my Xpand template I'd like to set the value of a variable to be
> available during the generation of a model element, and I don't want to
> pass that value to all the definitions...
> I saw that Xpand provides GLOBALVAR
> I'd like to set that var when I start to generate a model element, but I
> can't see how to do that...
> any help please?
> thanks in advance
> P.S. sorry, I'v just started using Xpand...
OK, I think I found the solution by googling much more, and I try to
answer myself :)
String getCurrentModelPackage() :
let currentModelPackage = (String) getGlobalVar("currentModelPackage") :
if(currentModelPackage == null) then (
) -> currentModelPackage
String setCurrentModelPackage(String s) :
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
Powered by FUDForum
. Page generated in 0.01738 seconds