summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hoffmann2012-02-14 08:37:13 (EST)
committer Tom Schindl2012-02-14 08:37:13 (EST)
commitd248dbac47b4dc3e5cbeef790aab9080f39348ae (patch)
treee9a2a571dab517c778b4aa4b347c7e393cb41df9
parent52c60416385268095111b80950627b8cd7df1da9 (diff)
downloadorg.eclipse.emf-d248dbac47b4dc3e5cbeef790aab9080f39348ae.zip
org.eclipse.emf-d248dbac47b4dc3e5cbeef790aab9080f39348ae.tar.gz
org.eclipse.emf-d248dbac47b4dc3e5cbeef790aab9080f39348ae.tar.bz2
Bug 354016 - EMFListValueProperty doesn't work for feature path and
objects from different packages
-rw-r--r--plugins/org.eclipse.emf.databinding/src/org/eclipse/emf/databinding/internal/EMFListPropertyDecorator.java2
-rw-r--r--plugins/org.eclipse.emf.databinding/src/org/eclipse/emf/databinding/internal/EMFListValueProperty.java28
-rw-r--r--tests/org.eclipse.emf.test.databinding/model/A.xmi24
-rw-r--r--tests/org.eclipse.emf.test.databinding/model/EMFDB.ecore16
-rw-r--r--tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/EMFPropertiesTest.java87
-rw-r--r--tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/B.java27
-rw-r--r--tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/D.java74
-rw-r--r--tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/E.java55
-rw-r--r--tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/EmfdbFactory.java18
-rw-r--r--tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/EmfdbPackage.java193
-rw-r--r--tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/BImpl.java88
-rw-r--r--tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/DImpl.java243
-rw-r--r--tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/EImpl.java181
-rw-r--r--tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/EmfdbFactoryImpl.java24
-rw-r--r--tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/EmfdbPackageImpl.java90
-rw-r--r--tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/util/EmfdbAdapterFactory.java40
-rw-r--r--tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/util/EmfdbSwitch.java85
17 files changed, 1215 insertions, 60 deletions
diff --git a/plugins/org.eclipse.emf.databinding/src/org/eclipse/emf/databinding/internal/EMFListPropertyDecorator.java b/plugins/org.eclipse.emf.databinding/src/org/eclipse/emf/databinding/internal/EMFListPropertyDecorator.java
index 2a50952..e9dd30a 100644
--- a/plugins/org.eclipse.emf.databinding/src/org/eclipse/emf/databinding/internal/EMFListPropertyDecorator.java
+++ b/plugins/org.eclipse.emf.databinding/src/org/eclipse/emf/databinding/internal/EMFListPropertyDecorator.java
@@ -67,7 +67,7 @@ public class EMFListPropertyDecorator extends ListProperty implements IEMFListPr
public IEMFValueProperty value(ListElementAccess<?> elementAccess)
{
- return new EMFValuePropertyDecorator(new EMFListValueProperty(eStructuralFeature, elementAccess), eStructuralFeature);
+ return new EMFValuePropertyDecorator(new EMFListValueProperty(delegate,eStructuralFeature, elementAccess), eStructuralFeature);
}
public EStructuralFeature getStructuralFeature()
diff --git a/plugins/org.eclipse.emf.databinding/src/org/eclipse/emf/databinding/internal/EMFListValueProperty.java b/plugins/org.eclipse.emf.databinding/src/org/eclipse/emf/databinding/internal/EMFListValueProperty.java
index c0ddd90..24438b2 100644
--- a/plugins/org.eclipse.emf.databinding/src/org/eclipse/emf/databinding/internal/EMFListValueProperty.java
+++ b/plugins/org.eclipse.emf.databinding/src/org/eclipse/emf/databinding/internal/EMFListValueProperty.java
@@ -13,10 +13,12 @@ package org.eclipse.emf.databinding.internal;
import java.util.List;
import org.eclipse.core.databinding.observable.Diffs;
+import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.property.INativePropertyListener;
import org.eclipse.core.databinding.property.IProperty;
import org.eclipse.core.databinding.property.ISimplePropertyListener;
import org.eclipse.core.databinding.property.SimplePropertyEvent;
+import org.eclipse.core.databinding.property.list.IListProperty;
import org.eclipse.core.databinding.property.value.SimpleValueProperty;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.databinding.IEMFListProperty.ListElementAccess;
@@ -32,13 +34,16 @@ public class EMFListValueProperty extends SimpleValueProperty
private final EStructuralFeature eStructuralFeature;
@SuppressWarnings("rawtypes")
private final ListElementAccess elementAccess;
+ private final IListProperty delegate;
/**
+ * @param delegate
* @param eStructuralFeature
* @param elementAccess
*/
- public EMFListValueProperty(EStructuralFeature eStructuralFeature, ListElementAccess<?> elementAccess)
+ public EMFListValueProperty(IListProperty delegate, EStructuralFeature eStructuralFeature, ListElementAccess<?> elementAccess)
{
+ this.delegate = delegate;
this.eStructuralFeature = eStructuralFeature;
this.elementAccess = elementAccess;
}
@@ -51,8 +56,7 @@ public class EMFListValueProperty extends SimpleValueProperty
@Override
protected Object doGetValue(Object source)
{
- EObject eObject = (EObject)source;
- List< ? > list = (List< ? >)eObject.eGet(eStructuralFeature);
+ List< ? > list = delegate.getList(source);
@SuppressWarnings("unchecked")
int idx = elementAccess.getReadValueIndex(list);
if (idx != WriteData.NO_INDEX)
@@ -62,17 +66,19 @@ public class EMFListValueProperty extends SimpleValueProperty
return null;
}
+ @SuppressWarnings("unchecked")
@Override
protected void doSetValue(Object source, Object value)
{
- EObject eObject = (EObject)source;
- @SuppressWarnings("unchecked")
- List<Object> list = (List<Object>)eObject.eGet(eStructuralFeature);
- @SuppressWarnings("unchecked")
- WriteData data = elementAccess.getWriteValueData(list);
- if (data != null)
- {
- doSetListValue((EObject)source, list, data, value);
+ IObservableList list = delegate.observe(source);
+ try {
+ WriteData data = elementAccess.getWriteValueData(list);
+ if (data != null)
+ {
+ doSetListValue((EObject)source, list, data, value);
+ }
+ } finally {
+ list.dispose();
}
}
diff --git a/tests/org.eclipse.emf.test.databinding/model/A.xmi b/tests/org.eclipse.emf.test.databinding/model/A.xmi
index 0512597..1dc242e 100644
--- a/tests/org.eclipse.emf.test.databinding/model/A.xmi
+++ b/tests/org.eclipse.emf.test.databinding/model/A.xmi
@@ -1,7 +1,23 @@
<?xml version="1.0" encoding="ASCII"?>
-<emfdb:A xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:emfdb="http://www.eclipse.org/emf/emfdb/1.0.0" xsi:schemaLocation="http://www.eclipse.org/emf/emfdb/1.0.0 EMFDB.ecore" string="Instance 1">
- <blist string="Instance 1"/>
+<emfdb:A xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:emfdb="http://www.eclipse.org/emf/emfdb/1.0.0"
+ xsi:schemaLocation="http://www.eclipse.org/emf/emfdb/1.0.0 EMFDB.ecore"
+ string="Instance 1">
+ <blist string="Instance 1">
+ <d name="Name of D">
+ <elist
+ name="First Element"/>
+ <elist
+ name="Element 2"/>
+ <elist
+ name="Last Element"/>
+ </d>
+ </blist>
<blist string="Instance 2"/>
- <cmap key="key 1" value="value 1"/>
- <cmap key="key 2" value="value 2"/>
+ <cmap key="key 1"
+ value="value 1"/>
+ <cmap key="key 2"
+ value="value 2"/>
</emfdb:A>
diff --git a/tests/org.eclipse.emf.test.databinding/model/EMFDB.ecore b/tests/org.eclipse.emf.test.databinding/model/EMFDB.ecore
index c324014..82adbfb 100644
--- a/tests/org.eclipse.emf.test.databinding/model/EMFDB.ecore
+++ b/tests/org.eclipse.emf.test.databinding/model/EMFDB.ecore
@@ -1,8 +1,6 @@
<?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="emfdb"
- nsURI="http://www.eclipse.org/emf/emfdb/1.0.0" nsPrefix="emfdb">
+<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="emfdb" nsURI="http://www.eclipse.org/emf/emfdb/1.0.0" nsPrefix="emfdb">
<eClassifiers xsi:type="ecore:EClass" name="A">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="string" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blist" upperBound="-1"
@@ -12,9 +10,19 @@
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="B">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="string" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="d" lowerBound="1" eType="#//D"
+ containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="C" instanceClassName="java.util.Map$Entry">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="D">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="elist" upperBound="-1"
+ eType="#//E" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="E">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
</ecore:EPackage>
diff --git a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/EMFPropertiesTest.java b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/EMFPropertiesTest.java
index 8168a37..301069f 100644
--- a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/EMFPropertiesTest.java
+++ b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/EMFPropertiesTest.java
@@ -80,13 +80,17 @@ public class EMFPropertiesTest extends TestCase
}
};
}
-
- public void testFeaturePath() {
+
+ public void testFeaturePath()
+ {
assertNotNull(FeaturePath.fromList(EmfdbPackage.Literals.A__BLIST));
- try {
+ try
+ {
FeaturePath.fromList(EmfdbPackage.Literals.A__BLIST, EmfdbPackage.Literals.B__STRING);
fail("Traversing list feature");
- } catch (IllegalArgumentException e) {
+ }
+ catch (IllegalArgumentException e)
+ {
// Ignore
}
}
@@ -277,13 +281,13 @@ public class EMFPropertiesTest extends TestCase
{
@Override
- public int getReadValueIndex(List< Object > list)
+ public int getReadValueIndex(List<Object> list)
{
return 0;
}
@Override
- public int getWriteValueIndex(List< Object > list)
+ public int getWriteValueIndex(List<Object> list)
{
return 0;
}
@@ -306,11 +310,14 @@ public class EMFPropertiesTest extends TestCase
b = EmfdbFactory.eINSTANCE.createB();
b.setString("New Element 2");
IObservableValue aObservable = valueProp.observe(a);
- try {
- aObservable.setValue(b);
- } finally {
- aObservable.dispose();
- }
+ try
+ {
+ aObservable.setValue(b);
+ }
+ finally
+ {
+ aObservable.dispose();
+ }
assertEquals("New Element 2", value.getValue());
}
@@ -432,4 +439,62 @@ public class EMFPropertiesTest extends TestCase
map.clear();
}
+ public void test_sublistElement()
+ {
+ Realm.runWithDefault(testRealm, new Runnable()
+ {
+
+ public void run()
+ {
+ _test_sublistElement();
+ }
+ });
+ }
+
+ public void _test_sublistElement()
+ {
+ A a = (A)resource.getContents().get(0);
+ IEMFListProperty lProp1 = EMFProperties.list(EmfdbPackage.Literals.A__BLIST);
+ System.err.println(lProp1.getClass());
+ IEMFValueProperty vProp1 = lProp1.value(new ListElementAccess<Object>()
+ {
+
+ public int getReadValueIndex(List<Object> list)
+ {
+ return 0;
+ }
+
+ @Override
+ public int getWriteValueIndex(List<Object> list)
+ {
+ return WriteData.NO_INDEX;
+ }
+ });
+ System.err.println(vProp1.getClass());
+
+ IEMFValueProperty vProp2 = vProp1.value(EmfdbPackage.Literals.B__D);
+ IEMFListProperty lProp2 = vProp2.list(EmfdbPackage.Literals.D__ELIST);
+ System.err.println(lProp2.getClass());
+
+ IEMFValueProperty vProp3 = lProp2.value(new ListElementAccess<Object>()
+ {
+
+ public int getReadValueIndex(List<Object> list)
+ {
+ return list.size() - 1;
+ }
+
+ @Override
+ public int getWriteValueIndex(List<Object> list)
+ {
+ return WriteData.NO_INDEX;
+ }
+ });
+
+ System.err.println(vProp3.observe(a).getValue());
+
+// IEMFValueProperty detailValue = vProp3.value(EmfdbPackage.Literals.E__NAME);
+// IObservableValue v = detailValue.observe(a);
+// System.err.println(v.getValue());
+ }
}
diff --git a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/B.java b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/B.java
index a52cd4a..135d73e 100644
--- a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/B.java
+++ b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/B.java
@@ -21,6 +21,7 @@ import org.eclipse.emf.ecore.EObject;
* The following features are supported:
* <ul>
* <li>{@link org.eclipse.emf.test.databinding.emfdb.B#getString <em>String</em>}</li>
+ * <li>{@link org.eclipse.emf.test.databinding.emfdb.B#getD <em>D</em>}</li>
* </ul>
* </p>
*
@@ -56,4 +57,30 @@ public interface B extends EObject
*/
void setString(String value);
+ /**
+ * Returns the value of the '<em><b>D</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>D</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>D</em>' containment reference.
+ * @see #setD(D)
+ * @see org.eclipse.emf.test.databinding.emfdb.EmfdbPackage#getB_D()
+ * @model containment="true" required="true"
+ * @generated
+ */
+ D getD();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.test.databinding.emfdb.B#getD <em>D</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>D</em>' containment reference.
+ * @see #getD()
+ * @generated
+ */
+ void setD(D value);
+
} // B
diff --git a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/D.java b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/D.java
new file mode 100644
index 0000000..3ffe359
--- /dev/null
+++ b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/D.java
@@ -0,0 +1,74 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.test.databinding.emfdb;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>D</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.test.databinding.emfdb.D#getElist <em>Elist</em>}</li>
+ * <li>{@link org.eclipse.emf.test.databinding.emfdb.D#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.test.databinding.emfdb.EmfdbPackage#getD()
+ * @model
+ * @generated
+ */
+public interface D extends EObject
+{
+ /**
+ * Returns the value of the '<em><b>Elist</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.emf.test.databinding.emfdb.E}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Elist</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Elist</em>' containment reference list.
+ * @see org.eclipse.emf.test.databinding.emfdb.EmfdbPackage#getD_Elist()
+ * @model containment="true"
+ * @generated
+ */
+ EList<E> getElist();
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.emf.test.databinding.emfdb.EmfdbPackage#getD_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.test.databinding.emfdb.D#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+} // D
diff --git a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/E.java b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/E.java
new file mode 100644
index 0000000..46b59cb
--- /dev/null
+++ b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/E.java
@@ -0,0 +1,55 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.test.databinding.emfdb;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>E</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.test.databinding.emfdb.E#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.test.databinding.emfdb.EmfdbPackage#getE()
+ * @model
+ * @generated
+ */
+public interface E extends EObject
+{
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.emf.test.databinding.emfdb.EmfdbPackage#getE_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.test.databinding.emfdb.E#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+} // E
diff --git a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/EmfdbFactory.java b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/EmfdbFactory.java
index b24dc0c..bd2b33e 100644
--- a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/EmfdbFactory.java
+++ b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/EmfdbFactory.java
@@ -49,6 +49,24 @@ public interface EmfdbFactory extends EFactory
B createB();
/**
+ * Returns a new object of class '<em>D</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>D</em>'.
+ * @generated
+ */
+ D createD();
+
+ /**
+ * Returns a new object of class '<em>E</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>E</em>'.
+ * @generated
+ */
+ E createE();
+
+ /**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/EmfdbPackage.java b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/EmfdbPackage.java
index 5880fa2..821d454 100644
--- a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/EmfdbPackage.java
+++ b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/EmfdbPackage.java
@@ -130,13 +130,22 @@ public interface EmfdbPackage extends EPackage
int B__STRING = 0;
/**
+ * The feature id for the '<em><b>D</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int B__D = 1;
+
+ /**
* The number of structural features of the '<em>B</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int B_FEATURE_COUNT = 1;
+ int B_FEATURE_COUNT = 2;
/**
@@ -178,6 +187,72 @@ public interface EmfdbPackage extends EPackage
/**
+ * The meta object id for the '{@link org.eclipse.emf.test.databinding.emfdb.impl.DImpl <em>D</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.test.databinding.emfdb.impl.DImpl
+ * @see org.eclipse.emf.test.databinding.emfdb.impl.EmfdbPackageImpl#getD()
+ * @generated
+ */
+ int D = 3;
+
+ /**
+ * The feature id for the '<em><b>Elist</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int D__ELIST = 0;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int D__NAME = 1;
+
+ /**
+ * The number of structural features of the '<em>D</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int D_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.test.databinding.emfdb.impl.EImpl <em>E</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.test.databinding.emfdb.impl.EImpl
+ * @see org.eclipse.emf.test.databinding.emfdb.impl.EmfdbPackageImpl#getE()
+ * @generated
+ */
+ int E = 4;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int E__NAME = 0;
+
+ /**
+ * The number of structural features of the '<em>E</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int E_FEATURE_COUNT = 1;
+
+
+ /**
* Returns the meta object for class '{@link org.eclipse.emf.test.databinding.emfdb.A <em>A</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -242,6 +317,17 @@ public interface EmfdbPackage extends EPackage
EAttribute getB_String();
/**
+ * Returns the meta object for the containment reference '{@link org.eclipse.emf.test.databinding.emfdb.B#getD <em>D</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>D</em>'.
+ * @see org.eclipse.emf.test.databinding.emfdb.B#getD()
+ * @see #getB()
+ * @generated
+ */
+ EReference getB_D();
+
+ /**
* Returns the meta object for class '{@link java.util.Map.Entry <em>C</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -276,6 +362,59 @@ public interface EmfdbPackage extends EPackage
EAttribute getC_Value();
/**
+ * Returns the meta object for class '{@link org.eclipse.emf.test.databinding.emfdb.D <em>D</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>D</em>'.
+ * @see org.eclipse.emf.test.databinding.emfdb.D
+ * @generated
+ */
+ EClass getD();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.emf.test.databinding.emfdb.D#getElist <em>Elist</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Elist</em>'.
+ * @see org.eclipse.emf.test.databinding.emfdb.D#getElist()
+ * @see #getD()
+ * @generated
+ */
+ EReference getD_Elist();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.test.databinding.emfdb.D#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.emf.test.databinding.emfdb.D#getName()
+ * @see #getD()
+ * @generated
+ */
+ EAttribute getD_Name();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.test.databinding.emfdb.E <em>E</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>E</em>'.
+ * @see org.eclipse.emf.test.databinding.emfdb.E
+ * @generated
+ */
+ EClass getE();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.test.databinding.emfdb.E#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.emf.test.databinding.emfdb.E#getName()
+ * @see #getE()
+ * @generated
+ */
+ EAttribute getE_Name();
+
+ /**
* Returns the factory that creates the instances of the model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -351,6 +490,14 @@ public interface EmfdbPackage extends EPackage
EAttribute B__STRING = eINSTANCE.getB_String();
/**
+ * The meta object literal for the '<em><b>D</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference B__D = eINSTANCE.getB_D();
+
+ /**
* The meta object literal for the '{@link org.eclipse.emf.test.databinding.emfdb.impl.CImpl <em>C</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -376,6 +523,50 @@ public interface EmfdbPackage extends EPackage
*/
EAttribute C__VALUE = eINSTANCE.getC_Value();
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.test.databinding.emfdb.impl.DImpl <em>D</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.test.databinding.emfdb.impl.DImpl
+ * @see org.eclipse.emf.test.databinding.emfdb.impl.EmfdbPackageImpl#getD()
+ * @generated
+ */
+ EClass D = eINSTANCE.getD();
+
+ /**
+ * The meta object literal for the '<em><b>Elist</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference D__ELIST = eINSTANCE.getD_Elist();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute D__NAME = eINSTANCE.getD_Name();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.test.databinding.emfdb.impl.EImpl <em>E</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.test.databinding.emfdb.impl.EImpl
+ * @see org.eclipse.emf.test.databinding.emfdb.impl.EmfdbPackageImpl#getE()
+ * @generated
+ */
+ EClass E = eINSTANCE.getE();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute E__NAME = eINSTANCE.getE_Name();
+
}
} //EmfdbPackage
diff --git a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/BImpl.java b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/BImpl.java
index 9e35156..20a16f0 100644
--- a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/BImpl.java
+++ b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/BImpl.java
@@ -12,12 +12,15 @@ package org.eclipse.emf.test.databinding.emfdb.impl;
import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.test.databinding.emfdb.B;
+import org.eclipse.emf.test.databinding.emfdb.D;
import org.eclipse.emf.test.databinding.emfdb.EmfdbPackage;
/**
@@ -28,6 +31,7 @@ import org.eclipse.emf.test.databinding.emfdb.EmfdbPackage;
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.emf.test.databinding.emfdb.impl.BImpl#getString <em>String</em>}</li>
+ * <li>{@link org.eclipse.emf.test.databinding.emfdb.impl.BImpl#getD <em>D</em>}</li>
* </ul>
* </p>
*
@@ -56,6 +60,16 @@ public class BImpl extends EObjectImpl implements B
protected String string = STRING_EDEFAULT;
/**
+ * The cached value of the '{@link #getD() <em>D</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getD()
+ * @generated
+ * @ordered
+ */
+ protected D d;
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
@@ -104,6 +118,70 @@ public class BImpl extends EObjectImpl implements B
* <!-- end-user-doc -->
* @generated
*/
+ public D getD()
+ {
+ return d;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetD(D newD, NotificationChain msgs)
+ {
+ D oldD = d;
+ d = newD;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EmfdbPackage.B__D, oldD, newD);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setD(D newD)
+ {
+ if (newD != d)
+ {
+ NotificationChain msgs = null;
+ if (d != null)
+ msgs = ((InternalEObject)d).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EmfdbPackage.B__D, null, msgs);
+ if (newD != null)
+ msgs = ((InternalEObject)newD).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EmfdbPackage.B__D, null, msgs);
+ msgs = basicSetD(newD, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, EmfdbPackage.B__D, newD, newD));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case EmfdbPackage.B__D:
+ return basicSetD(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
@@ -111,6 +189,8 @@ public class BImpl extends EObjectImpl implements B
{
case EmfdbPackage.B__STRING:
return getString();
+ case EmfdbPackage.B__D:
+ return getD();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -128,6 +208,9 @@ public class BImpl extends EObjectImpl implements B
case EmfdbPackage.B__STRING:
setString((String)newValue);
return;
+ case EmfdbPackage.B__D:
+ setD((D)newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -145,6 +228,9 @@ public class BImpl extends EObjectImpl implements B
case EmfdbPackage.B__STRING:
setString(STRING_EDEFAULT);
return;
+ case EmfdbPackage.B__D:
+ setD((D)null);
+ return;
}
super.eUnset(featureID);
}
@@ -161,6 +247,8 @@ public class BImpl extends EObjectImpl implements B
{
case EmfdbPackage.B__STRING:
return STRING_EDEFAULT == null ? string != null : !STRING_EDEFAULT.equals(string);
+ case EmfdbPackage.B__D:
+ return d != null;
}
return super.eIsSet(featureID);
}
diff --git a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/DImpl.java b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/DImpl.java
new file mode 100644
index 0000000..e8cb0b5
--- /dev/null
+++ b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/DImpl.java
@@ -0,0 +1,243 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.test.databinding.emfdb.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.emf.ecore.util.EObjectResolvingEList;
+
+import org.eclipse.emf.test.databinding.emfdb.D;
+import org.eclipse.emf.test.databinding.emfdb.E;
+import org.eclipse.emf.test.databinding.emfdb.EmfdbPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>D</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.test.databinding.emfdb.impl.DImpl#getElist <em>Elist</em>}</li>
+ * <li>{@link org.eclipse.emf.test.databinding.emfdb.impl.DImpl#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class DImpl extends EObjectImpl implements D
+{
+ /**
+ * The cached value of the '{@link #getElist() <em>Elist</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getElist()
+ * @generated
+ * @ordered
+ */
+ protected EList<E> elist;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected DImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return EmfdbPackage.Literals.D;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<E> getElist()
+ {
+ if (elist == null)
+ {
+ elist = new EObjectContainmentEList<E>(E.class, this, EmfdbPackage.D__ELIST);
+ }
+ return elist;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, EmfdbPackage.D__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case EmfdbPackage.D__ELIST:
+ return ((InternalEList<?>)getElist()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case EmfdbPackage.D__ELIST:
+ return getElist();
+ case EmfdbPackage.D__NAME:
+ return getName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case EmfdbPackage.D__ELIST:
+ getElist().clear();
+ getElist().addAll((Collection<? extends E>)newValue);
+ return;
+ case EmfdbPackage.D__NAME:
+ setName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case EmfdbPackage.D__ELIST:
+ getElist().clear();
+ return;
+ case EmfdbPackage.D__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case EmfdbPackage.D__ELIST:
+ return elist != null && !elist.isEmpty();
+ case EmfdbPackage.D__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} //DImpl
diff --git a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/EImpl.java b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/EImpl.java
new file mode 100644
index 0000000..c56fafe
--- /dev/null
+++ b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/EImpl.java
@@ -0,0 +1,181 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.test.databinding.emfdb.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+
+import org.eclipse.emf.test.databinding.emfdb.E;
+import org.eclipse.emf.test.databinding.emfdb.EmfdbPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>E</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.test.databinding.emfdb.impl.EImpl#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class EImpl extends EObjectImpl implements E
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return EmfdbPackage.Literals.E;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, EmfdbPackage.E__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case EmfdbPackage.E__NAME:
+ return getName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case EmfdbPackage.E__NAME:
+ setName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case EmfdbPackage.E__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case EmfdbPackage.E__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} //EImpl
diff --git a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/EmfdbFactoryImpl.java b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/EmfdbFactoryImpl.java
index be7e5a8..9aa507d 100644
--- a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/EmfdbFactoryImpl.java
+++ b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/EmfdbFactoryImpl.java
@@ -76,6 +76,8 @@ public class EmfdbFactoryImpl extends EFactoryImpl implements EmfdbFactory
case EmfdbPackage.A: return createA();
case EmfdbPackage.B: return createB();
case EmfdbPackage.C: return (EObject)createC();
+ case EmfdbPackage.D: return createD();
+ case EmfdbPackage.E: return createE();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
@@ -119,6 +121,28 @@ public class EmfdbFactoryImpl extends EFactoryImpl implements EmfdbFactory
* <!-- end-user-doc -->
* @generated
*/
+ public D createD()
+ {
+ DImpl d = new DImpl();
+ return d;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public E createE()
+ {
+ EImpl e = new EImpl();
+ return e;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EmfdbPackage getEmfdbPackage()
{
return (EmfdbPackage)getEPackage();
diff --git a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/EmfdbPackageImpl.java b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/EmfdbPackageImpl.java
index 521243b..6d7c601 100644
--- a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/EmfdbPackageImpl.java
+++ b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/impl/EmfdbPackageImpl.java
@@ -51,6 +51,20 @@ public class EmfdbPackageImpl extends EPackageImpl implements EmfdbPackage
private EClass cEClass = null;
/**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass dEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass eEClass = null;
+
+ /**
* Creates an instance of the model <b>Package</b>, registered with
* {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
* package URI value.
@@ -178,6 +192,16 @@ public class EmfdbPackageImpl extends EPackageImpl implements EmfdbPackage
* <!-- end-user-doc -->
* @generated
*/
+ public EReference getB_D()
+ {
+ return (EReference)bEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EClass getC()
{
return cEClass;
@@ -208,6 +232,56 @@ public class EmfdbPackageImpl extends EPackageImpl implements EmfdbPackage
* <!-- end-user-doc -->
* @generated
*/
+ public EClass getD()
+ {
+ return dEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getD_Elist()
+ {
+ return (EReference)dEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getD_Name()
+ {
+ return (EAttribute)dEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getE()
+ {
+ return eEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getE_Name()
+ {
+ return (EAttribute)eEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EmfdbFactory getEmfdbFactory()
{
return (EmfdbFactory)getEFactoryInstance();
@@ -240,10 +314,18 @@ public class EmfdbPackageImpl extends EPackageImpl implements EmfdbPackage
bEClass = createEClass(B);
createEAttribute(bEClass, B__STRING);
+ createEReference(bEClass, B__D);
cEClass = createEClass(C);
createEAttribute(cEClass, C__KEY);
createEAttribute(cEClass, C__VALUE);
+
+ dEClass = createEClass(D);
+ createEReference(dEClass, D__ELIST);
+ createEAttribute(dEClass, D__NAME);
+
+ eEClass = createEClass(E);
+ createEAttribute(eEClass, E__NAME);
}
/**
@@ -284,11 +366,19 @@ public class EmfdbPackageImpl extends EPackageImpl implements EmfdbPackage
initEClass(bEClass, org.eclipse.emf.test.databinding.emfdb.B.class, "B", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getB_String(), ecorePackage.getEString(), "string", null, 0, 1, org.eclipse.emf.test.databinding.emfdb.B.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getB_D(), this.getD(), null, "d", null, 1, 1, org.eclipse.emf.test.databinding.emfdb.B.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(cEClass, Map.Entry.class, "C", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getC_Key(), ecorePackage.getEString(), "key", null, 0, 1, Map.Entry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getC_Value(), ecorePackage.getEString(), "value", null, 0, 1, Map.Entry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEClass(dEClass, org.eclipse.emf.test.databinding.emfdb.D.class, "D", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getD_Elist(), this.getE(), null, "elist", null, 0, -1, org.eclipse.emf.test.databinding.emfdb.D.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getD_Name(), ecorePackage.getEString(), "name", null, 0, 1, org.eclipse.emf.test.databinding.emfdb.D.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(eEClass, org.eclipse.emf.test.databinding.emfdb.E.class, "E", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getE_Name(), ecorePackage.getEString(), "name", null, 0, 1, org.eclipse.emf.test.databinding.emfdb.E.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
// Create resource
createResource(eNS_URI);
}
diff --git a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/util/EmfdbAdapterFactory.java b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/util/EmfdbAdapterFactory.java
index 3f62116..18e0e74 100644
--- a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/util/EmfdbAdapterFactory.java
+++ b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/util/EmfdbAdapterFactory.java
@@ -99,6 +99,16 @@ public class EmfdbAdapterFactory extends AdapterFactoryImpl
return createCAdapter();
}
@Override
+ public Adapter caseD(D object)
+ {
+ return createDAdapter();
+ }
+ @Override
+ public Adapter caseE(E object)
+ {
+ return createEAdapter();
+ }
+ @Override
public Adapter defaultCase(EObject object)
{
return createEObjectAdapter();
@@ -166,6 +176,36 @@ public class EmfdbAdapterFactory extends AdapterFactoryImpl
}
/**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.test.databinding.emfdb.D <em>D</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.test.databinding.emfdb.D
+ * @generated
+ */
+ public Adapter createDAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.test.databinding.emfdb.E <em>E</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.test.databinding.emfdb.E
+ * @generated
+ */
+ public Adapter createEAdapter()
+ {
+ return null;
+ }
+
+ /**
* Creates a new adapter for the default case.
* <!-- begin-user-doc -->
* This default implementation returns null.
diff --git a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/util/EmfdbSwitch.java b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/util/EmfdbSwitch.java
index 9255515..97edcd6 100644
--- a/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/util/EmfdbSwitch.java
+++ b/tests/org.eclipse.emf.test.databinding/src/org/eclipse/emf/test/databinding/emfdb/util/EmfdbSwitch.java
@@ -16,6 +16,8 @@ import java.util.Map;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.util.Switch;
import org.eclipse.emf.test.databinding.emfdb.*;
/**
@@ -31,7 +33,7 @@ import org.eclipse.emf.test.databinding.emfdb.*;
* @see org.eclipse.emf.test.databinding.emfdb.EmfdbPackage
* @generated
*/
-public class EmfdbSwitch<T>
+public class EmfdbSwitch<T> extends Switch<T>
{
/**
* The cached model package
@@ -56,38 +58,17 @@ public class EmfdbSwitch<T>
}
/**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * Checks whether this is a switch for the given package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @parameter ePackage the package in question.
+ * @return whether this is a switch for the given package.
* @generated
*/
- public T doSwitch(EObject theEObject)
+ @Override
+ protected boolean isSwitchFor(EPackage ePackage)
{
- return doSwitch(theEObject.eClass(), theEObject);
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(EClass theEClass, EObject theEObject)
- {
- if (theEClass.eContainer() == modelPackage)
- {
- return doSwitch(theEClass.getClassifierID(), theEObject);
- }
- else
- {
- List<EClass> eSuperTypes = theEClass.getESuperTypes();
- return
- eSuperTypes.isEmpty() ?
- defaultCase(theEObject) :
- doSwitch(eSuperTypes.get(0), theEObject);
- }
+ return ePackage == modelPackage;
}
/**
@@ -97,6 +78,7 @@ public class EmfdbSwitch<T>
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/
+ @Override
protected T doSwitch(int classifierID, EObject theEObject)
{
switch (classifierID)
@@ -122,6 +104,20 @@ public class EmfdbSwitch<T>
if (result == null) result = defaultCase(theEObject);
return result;
}
+ case EmfdbPackage.D:
+ {
+ D d = (D)theEObject;
+ T result = caseD(d);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case EmfdbPackage.E:
+ {
+ E e = (E)theEObject;
+ T result = caseE(e);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
default: return defaultCase(theEObject);
}
}
@@ -175,6 +171,38 @@ public class EmfdbSwitch<T>
}
/**
+ * Returns the result of interpreting the object as an instance of '<em>D</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>D</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseD(D object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>E</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>E</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseE(E object)
+ {
+ return null;
+ }
+
+ /**
* Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
@@ -185,6 +213,7 @@ public class EmfdbSwitch<T>
* @see #doSwitch(org.eclipse.emf.ecore.EObject)
* @generated
*/
+ @Override
public T defaultCase(EObject object)
{
return null;