Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xpand] Access ClassAttribute before DEFINE Class
[Xpand] Access ClassAttribute before DEFINE Class [message #762252] Wed, 07 December 2011 19:03 Go to next message
ralf.teckelmann is currently offline ralf.teckelmannFriend
Messages: 2
Registered: December 2011
Junior Member
Hello Guys,

I'm very new to Xpand and I have the following problem.
I got a Class "Template" with an Attribute "type" which is the "Root class" of my model.
I want to do something like:

<<Import model>>

<< IF <<type>>!="String">>
<<DEFINE main FOR Template>>
...
<<ELSE>>
...
<<ENDIF>>

Is it possible to do this this way or through another Xpand-mechanism?
From an OO point of view it could seem stupid to try to access the attribute of an object before the object exists, but as I said I'm new to the language.

Mainly I do ask this question, because I perceived, if I write the shown part into my x.xpt I wouldn't get any fault symbols for syntax errors in current Eclipse Modelling distribution even if I implement faults like <<EDEF>> instead of <<ENDDEFINE>> in later parts of the x.xpt.

Thanks in advance
Re: [Xpand] Access ClassAttribute before DEFINE Class [message #762261 is a reply to message #762252] Wed, 07 December 2011 19:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14729
Registered: July 2009
Senior Member
Hi,

there editor is sometimes buggy indeed. please make sure you configure thecorrect metamodel kind in your projects xtand/xpand properties section.
and yes what you want to do is totally nonsense
it should look like

«IMPORT model»
«DEFINE main FOR Template»
«FILE "test.txt"»
«IF type=="String"»
//hey this is a string
«ENDIF»
«ENDFILE»
«ENDDEFINE»


~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: [Xpand] Access ClassAttribute before DEFINE Class [message #762288 is a reply to message #762261] Wed, 07 December 2011 20:07 Go to previous message
ralf.teckelmann is currently offline ralf.teckelmannFriend
Messages: 2
Registered: December 2011
Junior Member
Good Evening Christian,

thank you for your fast reply and the affirmation that my idea was stupid Smile.

Cheers
Previous Topic:[Acceleo] how to get the ID of an EObject
Next Topic:[Xpand] Questions regarding implementing MetaModelContributor
Goto Forum:
  


Current Time: Sat Nov 09 01:33:35 GMT 2024

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

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

Back to the top