summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-08 08:32:51 (EDT)
committerEike Stepper2007-08-08 08:32:51 (EDT)
commitadf245b720b8e3c4bc9723a87f0682b89c044dc3 (patch)
treee7bc5a940917493477b2ff415566330da7548217
parent1ca9054011421c5026d90ee4e784698854b8e7fc (diff)
downloadcdo-adf245b720b8e3c4bc9723a87f0682b89c044dc3.zip
cdo-adf245b720b8e3c4bc9723a87f0682b89c044dc3.tar.gz
cdo-adf245b720b8e3c4bc9723a87f0682b89c044dc3.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOCallbackImpl.java41
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyImpl.java61
2 files changed, 29 insertions, 73 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOCallbackImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOCallbackImpl.java
index e54d24f..6376fb4 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOCallbackImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOCallbackImpl.java
@@ -11,7 +11,6 @@
package org.eclipse.emf.internal.cdo;
import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.CDOCallback;
@@ -19,6 +18,8 @@ import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.util.FSMUtil;
+import java.util.List;
+
/**
* @author Eike Stepper
*/
@@ -55,7 +56,7 @@ public class CDOCallbackImpl extends CDOAdapterImpl implements CDOCallback
switch (msg.getEventType())
{
case Notification.ADD:
- notifyAdd((InternalEObject)msg.getNewValue());
+ notifyAdd(msg.getNewValue());
break;
case Notification.ADD_MANY:
@@ -63,7 +64,7 @@ public class CDOCallbackImpl extends CDOAdapterImpl implements CDOCallback
break;
case Notification.REMOVE:
- notifyRemove((InternalEObject)msg.getOldValue());
+ notifyRemove(msg.getOldValue());
break;
case Notification.REMOVE_MANY:
@@ -88,9 +89,9 @@ public class CDOCallbackImpl extends CDOAdapterImpl implements CDOCallback
private void notifyAddMany(Notification msg)
{
- EList<InternalEObject> newValues = (EList<InternalEObject>)msg.getNewValue();
- EList<InternalEObject> oldValues = (EList<InternalEObject>)msg.getOldValue();
- for (InternalEObject newValue : newValues)
+ List newValues = (List)msg.getNewValue();
+ List oldValues = (List)msg.getOldValue();
+ for (Object newValue : newValues)
{
if (!oldValues.contains(newValue))
{
@@ -99,20 +100,23 @@ public class CDOCallbackImpl extends CDOAdapterImpl implements CDOCallback
}
}
- private void notifyAdd(InternalEObject instance)
+ private void notifyAdd(Object instance)
{
- if (instance.eDeliver())
+ if (instance instanceof InternalEObject)
{
- InternalCDOObject object = FSMUtil.adapt(instance, view);
- CDOStateMachine.INSTANCE.attach(object, cdoResource(), view);
+ if (((InternalEObject)instance).eDeliver())
+ {
+ InternalCDOObject object = FSMUtil.adapt(instance, view);
+ CDOStateMachine.INSTANCE.attach(object, cdoResource(), view);
+ }
}
}
private void notifyRemoveMany(Notification msg)
{
- EList<InternalEObject> newValues = (EList<InternalEObject>)msg.getNewValue();
- EList<InternalEObject> oldValues = (EList<InternalEObject>)msg.getOldValue();
- for (InternalEObject oldValue : oldValues)
+ List newValues = (List)msg.getNewValue();
+ List oldValues = (List)msg.getOldValue();
+ for (Object oldValue : oldValues)
{
if (!newValues.contains(oldValue))
{
@@ -121,12 +125,15 @@ public class CDOCallbackImpl extends CDOAdapterImpl implements CDOCallback
}
}
- private void notifyRemove(InternalEObject instance)
+ private void notifyRemove(Object instance)
{
- if (instance.eDeliver())
+ if (instance instanceof InternalEObject)
{
- InternalCDOObject object = FSMUtil.adapt(instance, view);
- CDOStateMachine.INSTANCE.detach(object, cdoResource(), view);
+ if (((InternalEObject)instance).eDeliver())
+ {
+ InternalCDOObject object = FSMUtil.adapt(instance, view);
+ CDOStateMachine.INSTANCE.detach(object, cdoResource(), view);
+ }
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyImpl.java
index bcd7d76..47b8138 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyImpl.java
@@ -389,69 +389,18 @@ public abstract class CDOLegacyImpl extends CDOWrapperImpl
protected Object getInstanceValue(InternalEObject instance, CDOFeatureImpl feature)
{
- // Class<?> targetClass = target.getClass();
- // String featureName = feature.getName();
EStructuralFeature eFeature = ModelUtil.getEFeature(feature, cdoView().getSession().getPackageRegistry());
- Object value = instance.eGet(eFeature);
- return value;
-
- // // TODO BOOLEAN_OBJECT?
- // String methodName = GenUtil.getFeatureGetterName(featureName,
- // feature.getType() == CDOType.BOOLEAN);
- // Method method = getMethod(targetClass, methodName,
- // ReflectUtil.NO_PARAMETERS);
- //
- // String fieldName = featureName;// TODO safeName()
- // Field field = getField(targetClass, fieldName);
- // if (field == null && feature.getType() == CDOType.BOOLEAN)
+ // if (eFeature.isUnsettable() &&!instance.eIsSet(eFeature))
// {
- // if (targetClass.isAssignableFrom(EAttributeImpl.class) ||
- // targetClass.isAssignableFrom(EClassImpl.class)
- // || targetClass.isAssignableFrom(EDataTypeImpl.class) ||
- // targetClass.isAssignableFrom(EReferenceImpl.class)
- // || targetClass.isAssignableFrom(EStructuralFeatureImpl.class)
- // || targetClass.isAssignableFrom(ETypedElementImpl.class))
- // {
- // // *******************************************
- // // ID_EFLAG = 1 << 15;
- // // *******************************************
- // // ABSTRACT_EFLAG = 1 << 8;
- // // INTERFACE_EFLAG = 1 << 9;
- // // *******************************************
- // // SERIALIZABLE_EFLAG = 1 << 8;
- // // *******************************************
- // // CONTAINMENT_EFLAG = 1 << 15;
- // // RESOLVE_PROXIES_EFLAG = 1 << 16;
- // // *******************************************
- // // CHANGEABLE_EFLAG = 1 << 10;
- // // VOLATILE_EFLAG = 1 << 11;
- // // TRANSIENT_EFLAG = 1 << 12;
- // // UNSETTABLE_EFLAG = 1 << 13;
- // // DERIVED_EFLAG = 1 << 14;
- // // *******************************************
- // // ORDERED_EFLAG = 1 << 8;
- // // UNIQUE_EFLAG = 1 << 9;
- // // *******************************************
- //
- // String flagName = GenUtil.getFeatureUpperName(featureName) + "_EFLAG";
- // int flagsMask = getEFlagMask(targetClass, flagName);
- //
- // field = getField(targetClass, "eFlags");
- // int value = (Integer)getFiedValue(target, field);
- // return new Boolean((value & flagsMask) != 0);
- // }
+ // return eFeature.getDefaultValue();
// }
- //
- // if (field == null)
- // {
- // throw new ImplementationError("Field not found: " + fieldName);
- // }
- //
- // return getFiedValue(target, field);
+
+ return instance.eGet(eFeature);
}
protected void setInstanceValue(InternalEObject instance, CDOFeatureImpl feature, Object value)
{
+ // TODO Don't use Java reflection
Class<?> instanceClass = instance.getClass();
String featureName = feature.getName();
String fieldName = featureName;// TODO safeName()