Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » XPand(Global Variables)
XPand [message #1006141] Wed, 30 January 2013 03:00 Go to next message
serhat gezgin is currently offline serhat gezgin
Messages: 237
Registered: January 2013
Location: Izmir
Senior Member
How can i use global variable on xpand template file ? I m looking example but cant find Sad

can u help me ?
Re: XPand [message #1006375 is a reply to message #1006141] Thu, 31 January 2013 02:35 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten Thoms
Messages: 353
Registered: July 2009
Location: Dortmund
Senior Member

Hi Serhat,

You usually would have an Xtend function to return the value and access this function:

templates.Foo.ext:
==================

String MyGlobalVarValue() : GLOBALVAR my_global_var_name;


templates.Foo.xpt:
==================

extension templates::Foo;

...

«MyGlobalVarValue()»


Kind regards,
~Karsten


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: XPand [message #1007177 is a reply to message #1006375] Mon, 04 February 2013 13:28 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezgin
Messages: 237
Registered: January 2013
Location: Izmir
Senior Member
when i used global var i have

4538 WARN GlobalVarExpression - Global variable 'my_global_var_name' is null. Is it configured?

and

ERROR AbstractExpressionsUsingWorkflowComponent - Error in Component of type org.eclipse.xpand2.Generator:
EvaluationException : Nullevaluation!

i cant used my global variable Sad
Re: XPand [message #1007181 is a reply to message #1007177] Mon, 04 February 2013 14:22 Go to previous message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6225
Registered: July 2009
Senior Member
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1187.34">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #929292}
</style>
</head>
<body>
<p class="p1">Hi,</p>
<p class="p2"><br></p>
<p class="p1">have a look at the docs</p>
<p class="p1"><a href="http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.xpand.doc%2Fhelp%2Fr10_expressions_language.html">http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.xpand.doc%2Fhelp%2Fr10_expressions_language.html</a></p>
<p class="p2"><br></p>
<p class="p1">~Christian</p>
<p class="p3"><br></p>
<p class="p4"><br></p>
<p class="p5">--<span class="Apple-converted-space"> </span></p>
<p class="p5">Need training, onsite consulting or any other kind of help for Xtext?<span class="Apple-converted-space"> </span></p>
<p class="p5">Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de</p>
</body>
</html>
Previous Topic:[Acceleo] Using ecore types in generation modules
Next Topic:Xpand with Unit test
Goto Forum:
  


Current Time: Wed Aug 27 11:06:33 EDT 2014

Powered by FUDForum. Page generated in 0.03042 seconds