|
Re: [Xpand] setting the value of a global variable from xtend? [message #646709 is a reply to message #646706] |
Thu, 30 December 2010 05:19  |
Eclipse User |
|
|
|
On 12/30/2010 10:54 AM, Lorenzo Bettini wrote:
> Hi
>
> 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
> Lorenzo
>
> 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 :)
extension org::eclipse::xtend::util::stdlib::globalvar;
String getCurrentModelPackage() :
let currentModelPackage = (String) getGlobalVar("currentModelPackage") :
if(currentModelPackage == null) then (
storeGlobalVar("currentModelPackage", "")
) -> currentModelPackage
;
String setCurrentModelPackage(String s) :
storeGlobalVar("currentModelPackage", 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
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
|
|
|
Powered by
FUDForum. Page generated in 0.05948 seconds