Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » createPropertyEditor for EReferenceImpl(choiceOfValues not limited to selected reference class)
createPropertyEditor for EReferenceImpl [message #668083] Tue, 03 May 2011 16:51 Go to next message
Jay Norwood is currently offline Jay Norwood
Messages: 112
Registered: July 2009
Senior Member
I have a model with an attribute which is an EReference to a single selected class type. The class is derived from an abstract class, but in this case I have selected only a single particular class for the EReference, and wish to select only a single instance of that explicit class as the assigned value. Right clicking on the property sheet line creates a list named choiceOfValues in PropertyDescriptor:createPropertyEditor. It gets into the section handling an EStructuralFeature, and the feature is an EReferenceImpl. The problem I'm seeing is that there are items other than the particular referenced class being added to the list.

I'll need to generate a small example ecore that demonstrates the problem. Is this a known issue or limitation? I didn't find discussion.
Re: createPropertyEditor for EReferenceImpl [message #668111 is a reply to message #668083] Tue, 03 May 2011 19:06 Go to previous messageGo to next message
Jay Norwood is currently offline Jay Norwood
Messages: 112
Registered: July 2009
Senior Member
This is the small test case ecore model, which is intended to limit assignment of the refinstance attribute with a reference to a Leaf1Type.

<?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="refbug"
nsURI="http:///refbug.ecore" nsPrefix="refbug">
<eClassifiers xsi:type="ecore:EClass" name="Root" eSuperTypes="#//Node">
<eStructuralFeatures xsi:type="ecore:EReference" name="children" upperBound="-1"
eType="#//InnerOrLeaf" containment="true" resolveProxies="false"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Inner" eSuperTypes="#//Leaf1Type">
<eStructuralFeatures xsi:type="ecore:EReference" name="children" upperBound="-1"
eType="#//InnerOrLeaf" containment="true" resolveProxies="false"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Leaf1Type" eSuperTypes="#//InnerOrLeaf">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="leafId" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="InnerOrLeaf" abstract="true" eSuperTypes="#//Node"/>
<eClassifiers xsi:type="ecore:EClass" name="Node" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Leaf2Type" eSuperTypes="#//InnerOrLeaf">
<eStructuralFeatures xsi:type="ecore:EReference" name="Vars" upperBound="-1" eType="#//VStruct"
containment="true" resolveProxies="false"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="VStruct">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="refinstance" lowerBound="1"
eType="#//Leaf1Type"/>
</eClassifiers>
</ecore:EPackage>


------------
This shows that an assignment was allowed of an refbug Inner type to refinstance, and in fact the Inner instance in1 was selected from the dropdown list. This also validates, which I find surprising. I would have expected refinstance dropdown to contain only the Leaf1Type, labeled lf1.

<?xml version="1.0" encoding="UTF-8"?>
<refbug:Root xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:refbug="http:///refbug.ecore">
<children xsi:type="refbug:Inner" label="in1">
<children xsi:type="refbug:Leaf1Type" label="lf1"/>
<children xsi:type="refbug:Leaf2Type" label="lf2">
<Vars name="vs1" refinstance="//@children.0"/>
</children>
</children>
</refbug:Root>
Re: createPropertyEditor for EReferenceImpl, Never Mind [message #668125 is a reply to message #668083] Tue, 03 May 2011 21:00 Go to previous message
Jay Norwood is currently offline Jay Norwood
Messages: 112
Registered: July 2009
Senior Member
This was totally my fault. Error in the ecore model. Should have been below. Works as it should.

<?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="refbug"
nsURI="http:///refbug.ecore" nsPrefix="refbug">
<eClassifiers xsi:type="ecore:EClass" name="Root" eSuperTypes="#//Node">
<eStructuralFeatures xsi:type="ecore:EReference" name="children" upperBound="-1"
eType="#//InnerOrLeaf" containment="true" resolveProxies="false"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Inner" eSuperTypes="#//InnerOrLeaf">
<eStructuralFeatures xsi:type="ecore:EReference" name="children" upperBound="-1"
eType="#//InnerOrLeaf" containment="true" resolveProxies="false"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Leaf1Type" eSuperTypes="#//InnerOrLeaf">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="leafId" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="InnerOrLeaf" abstract="true" eSuperTypes="#//Node"/>
<eClassifiers xsi:type="ecore:EClass" name="Node" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Leaf2Type" eSuperTypes="#//InnerOrLeaf">
<eStructuralFeatures xsi:type="ecore:EReference" name="Vars" upperBound="-1" eType="#//VStruct"
containment="true" resolveProxies="false"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="VStruct">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="refinstance" lowerBound="1"
eType="#//Leaf1Type"/>
</eClassifiers>
</ecore:EPackage>
Previous Topic:[EMF Query2] Issue with alias in an or textual query
Next Topic:generate specific xmi ids for eobjects
Goto Forum:
  


Current Time: Wed Sep 17 01:42:29 GMT 2014

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

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