|
Re: [Xpand] null value of eContainer and containment feature [message #651488 is a reply to message #651444] |
Mon, 31 January 2011 11:41 |
|
Hello Krzysztof,
i cannot reproduce the problem with this simple example
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
nsURI="http://www.example.com/test" nsPrefix="test">
<eClassifiers xsi:type="ecore:EClass" name="Model">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="elements" upperBound="-1"
eType="#//Element" containment="true" eOpposite="#//Element/model"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Element">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="model" eType="#//Model"
eOpposite="#//Model/elements"/>
</eClassifiers>
</ecore:EPackage>
<?xml version="1.0" encoding="ASCII"?>
<test:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:test="http://www.example.com/test" xsi:schemaLocation="http://www.example.com/test test.ecore" name="TestModel">
<elements name="E1"/>
<elements name="E2"/>
</test:Model>
«DEFINE main FOR test::Model»
«FILE "test.txt"»
«FOREACH elements AS e»
«e.name» in «e.model.name»
«ENDFOREACH»
«ENDFILE»
«ENDDEFINE»
module test.Workflow
import org.eclipse.emf.mwe.utils.*
Workflow {
bean = org.eclipse.emf.mwe.utils.StandaloneSetup {
platformUri = ".."
registerEcoreFile = "platform:/resource/test/src/test.ecore"
}
component = Reader {
uri = "platform:/resource/test/src/Model.xmi"
modelSlot = "model"
}
component = org.eclipse.xpand2.Generator {
metaModel = org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel {}
expand = "templates::template::main FOR model"
outlet = {
path = "src-gen"
}
}
}
~ Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04835 seconds