Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlgoubet2011-09-26 12:36:29 +0000
committerlgoubet2011-09-26 12:49:50 +0000
commit402a223f4fc7e4ac003b9b16ef66be69b360081c (patch)
tree047bbebf28aca6e483e639ea081641f1a74ec5ff
parenta15a93db4c27730b1847ad6164079f81da790235 (diff)
downloadorg.eclipse.emf.compare-402a223f4fc7e4ac003b9b16ef66be69b360081c.tar.gz
org.eclipse.emf.compare-402a223f4fc7e4ac003b9b16ef66be69b360081c.tar.xz
org.eclipse.emf.compare-402a223f4fc7e4ac003b9b16ef66be69b360081c.zip
[357942] CDO does not use "basicEList" but its own implementation of
InternalEList.
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/util/EFactory.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/util/EFactory.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/util/EFactory.java
index 53574ff06..feeb0ee30 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/util/EFactory.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/util/EFactory.java
@@ -24,6 +24,7 @@ import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EEnumLiteral;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.InternalEList;
/**
* This is a factory for an ecore metamodel. There is a factory by package. Each factory is used to create
@@ -83,16 +84,24 @@ public abstract class EFactory {
if (feature.isMany()) {
if (arg != null) {
final Object manyValue = object.eGet(feature);
- if (manyValue instanceof BasicEList) {
- final BasicEList<? super T> basicEList = (BasicEList<? super T>)manyValue;
+ if (manyValue instanceof InternalEList<?>) {
+ final InternalEList<? super T> basicEList = (InternalEList<? super T>)manyValue;
final int listSize = basicEList.size();
if (elementIndex > -1 && elementIndex < listSize) {
basicEList.addUnique(elementIndex, arg);
} else {
basicEList.addUnique(arg);
}
- } else if (manyValue instanceof Collection) {
- ((Collection)manyValue).add(arg);
+ } else if (manyValue instanceof List<?>) {
+ final List<? super T> list = (List<? super T>)manyValue;
+ final int listSize = list.size();
+ if (elementIndex > -1 && elementIndex < listSize) {
+ list.add(elementIndex, arg);
+ } else {
+ list.add(arg);
+ }
+ } else if (manyValue instanceof Collection<?>) {
+ ((Collection<? super T>)manyValue).add(arg);
}
}
} else {

Back to the top