Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » [Xpand] null value of eContainer and containment feature
[Xpand] null value of eContainer and containment feature [message #651444] Sun, 30 January 2011 18:52 Go to next message
Eclipse UserFriend
Hi, it's been awhile since I asked about oaw stack, but I got some strange error latelty.

I have two classes in my model: Parent and Child. They have bidirectional containment relation parent<>----children.

When I open the model file in MoDisco editor as well as in ecore reflective editor, all children have theirs 'parent' feature set, but Xpand claim that all 'parent' features (as well as eContainer) are null ! How is it possible?

I use MWE2, I don't use other parts of xtext, I use emf.mwe.utils.Reader and all of that on Eclipse 3.6 (STS edition) with standard updates.

Regards,
Krzysztof Kowalczyk
Re: [Xpand] null value of eContainer and containment feature [message #651488 is a reply to message #651444] Mon, 31 January 2011 06:41 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: [Xpand] null value of eContainer and containment feature [message #651871 is a reply to message #651488] Tue, 01 February 2011 15:37 Go to previous messageGo to next message
Eclipse UserFriend
Yout test example works right. Now is time to look for differences Wink
Is github ok to share eventual not working examples?
Re: [Xpand] null value of eContainer and containment feature [message #651872 is a reply to message #651871] Tue, 01 February 2011 15:39 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

yes github is ok for me

~Christian
Re: [Xpand] null value of eContainer and containment feature [message #651898 is a reply to message #651872] Tue, 01 February 2011 18:06 Go to previous message
Eclipse UserFriend
It seems that I had to mess up something in genmodel, because the problem only occurs when I use "ecoreGeneratedPackage" not the Ecore file.

Nevertheless, the handshaking is working for generated Java classes (at least at creation time), as I did not supress containment in genmodel. I did turn of some other options though, so I will have to check whats wrong in future. Maybe its connected to notifications or reflexion. In any case I do have workaround for now Smile

Thanks,
Krzysztof Kowalczyk
Previous Topic:Eclipse Community Awards
Next Topic:comboboxcelleditor not firing
Goto Forum:
  


Current Time: Sun Jul 06 21:27:34 EDT 2025

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

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

Back to the top