Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [XPand] questions in using AROUND
[XPand] questions in using AROUND [message #650857] Wed, 26 January 2011 22:05 Go to next message
Thomas Lauria is currently offline Thomas LauriaFriend
Messages: 4
Registered: January 2011
Junior Member
Hey there,
first of all: I am new here and if I am violating the netiquette somehow, give me a hint please.

My Problem: My AROUND Statement in a XPand Template won't be weaved around the code.
I try to use an AROUND statement similar to the following, all in one file:

«DEFINE foo FOR FooType» FOO «ENDDEFINE»
«DEFINE foo FOR BarType» BAR «ENDDEFINE»

«AROUND foo FOR FooType»
ABC «targetDef.proceed()» 123
«ENDAROUND»

«EXPAND foo FOR FooType»


I am expecting as output: "ABC FOO 123" but I am getting only " FOO ", so IMHO the AROUND is not applied.
I tried also the AROUND with the fully qualified name bar::bar::foo and with wildcards "*foo*", but nothing happens.

Can't I use AROUNDs in the same file as the DEFINE?
Has I to prepare something in the workflow to use the AROUND statement?
Or is there another common pitfall in using AROUNDs?

I am using the Eclipse Helios Release.

Thank you,
Thomas
Re: [XPand] questions in using AROUND [message #650860 is a reply to message #650857] Wed, 26 January 2011 22:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

yes you can have the advices in the same file but this is a bad bad practice

but your advices have to be full qualified

«AROUND templates::root::element FOR test::Element»
//this is the element «name»
«targetDef.proceed()»
«ENDAROUND»


and if cource you have to prepare something in the workflow

    <component adviceTarget="generator"	id="reflectionAdvice" class="org.eclipse.xpand2.GeneratorAdvice">
		<advices value="templates::root"/>
	</component>
	
.....
	
	<component class="org.eclipse.xpand2.Generator" id="generator">
		<metaModel id="mm"
			class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>

		<expand
			value="templates::root::Root FOR model" />
			<outlet path="src-gen" >
				<postprocessor class="org.eclipse.xpand2.output.JavaBeautifier" />
			</outlet>
	</component>


~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [XPand] questions in using AROUND [message #652845 is a reply to message #650860] Mon, 07 February 2011 10:51 Go to previous message
Thomas Lauria is currently offline Thomas LauriaFriend
Messages: 4
Registered: January 2011
Junior Member
ok, thank you.
The entry in the workflow was missing.
But it seems like that the AROUND Statement isn't the right solution for my problem.

Previous Topic:[Xtend/XPand] Strange behaviour of checks
Next Topic:Binary code generation with Xtend/Xpand/Xtend2?
Goto Forum:
  


Current Time: Wed Apr 24 23:27:58 GMT 2024

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

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

Back to the top