|
Re: Errors in XPAND [message #798285 is a reply to message #798269] |
Tue, 14 February 2012 13:43 |
|
First, elements from Xtext models will only be referrable when they have a name. By default, your Entity types should have a name attribute like
Entity1: 'Entity1' name=ID ';'
Otherwise the Reader component would report something like "Could not find any exported element of type Entity1".
The name of elements can be also computed by providing a different IQualifiedNameProvider and bound it to the RuntimeModule, the default implementation will search for the "name" attributes to compute qualified names for elements. Only elements for which the IQualifiedNameProvider returns non-null can be exported into a slot and then passed the Xpand.
The "Collection type expected!" error occurs because there is no multi-valued reference from Entity1 to Entity2 named "Entity2". If you would like to expand each Entity2 from the same model as Entity1, you could go up to the model.
«DEFINE main FOR Entity1»
«FILE name+".java"»
This is Entity1
«EXPAND test FOREACH ((Model)eContainer).entity2»
«ENDFILE-»
«ENDDEFINE»
Usually this does not really make sense. Usually cross-references would be better here. You should look at the resulting Ecore metamodel from your grammar, this would make it easier to understand your Xpand templates.
Regards,
~Karsten
Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
|
|
|
Re: Errors in XPAND [message #798312 is a reply to message #798285] |
Tue, 14 February 2012 14:19 |
terry tonery Messages: 34 Registered: February 2012 |
Member |
|
|
Thank you,
I tried the solution but this time I received:
Multiple markers at this line
- Collection type expected!
- Unknown org::xtext::example::mydsl::myDsl::Entity1
property, variable, type or enumeration literal 'eContainer'
- Template.xpt [line: 25] - EXPAND
error.
[Updated on: Tue, 14 February 2012 14:24] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Errors in XPAND [message #799114 is a reply to message #799072] |
Wed, 15 February 2012 13:12 |
|
Hi still cannot reproduce this. Can you once more post template and
grammar and make sure you use javsbeansmetamodel in editor and
workflow. And can you once more post the error message and ensure
that you call the eContainer () operation and not the eContainer
property
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
|
Re: Errors in XPAND [message #799771 is a reply to message #799717] |
Thu, 16 February 2012 09:42 |
|
1) The import must be for mydsl5
«IMPORT org::xtext::example::mydsl5::myDsl»
«EXTENSION templates::Extensions»
«DEFINE main FOR Entity1»
«FILE name+".java"»
2) the folder "templates" must be on the root of your classpath. The template "Template.xpt" should be in there.
To check this: Open the Navigator view, the output folder is by default "bin", so it must be
- projectroot
+- bin
+- templates
+- Template.xpt
Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07758 seconds