summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-24 03:56:00 (EDT)
committerEike Stepper2007-07-24 03:56:00 (EDT)
commit1a527d27cb234c0eb96de57acc16393b9fa53883 (patch)
tree6493f6bc575e0d2a1e903cb80826728e421d847f
parentc793ca705c950d674e3e77430d9a027d4973e57a (diff)
downloadcdo-1a527d27cb234c0eb96de57acc16393b9fa53883.zip
cdo-1a527d27cb234c0eb96de57acc16393b9fa53883.tar.gz
cdo-1a527d27cb234c0eb96de57acc16393b9fa53883.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java46
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java6
2 files changed, 50 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java
index 57128aa..0483c8f 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOAdapterImpl.java
@@ -39,6 +39,7 @@ import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.EStructuralFeature.Setting;
+import org.eclipse.emf.ecore.impl.BasicEObjectImpl;
import org.eclipse.emf.ecore.impl.EAttributeImpl;
import org.eclipse.emf.ecore.impl.EClassImpl;
import org.eclipse.emf.ecore.impl.EDataTypeImpl;
@@ -242,6 +243,7 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
public void cdoInternalResolveRevision()
{
transferRevisionToTarget();
+ cdoInternalSetState(CDOState.CLEAN);
}
public InternalEObject cdoInternalInstance()
@@ -270,6 +272,33 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
{
InternalEObject target = getTarget();
CDOViewImpl view = cdoView();
+
+ // Handle containment
+ EObject container = target.eContainer();
+ if (container != null)
+ {
+ if (container instanceof CDOResource)
+ {
+ revision.setResourceID(((CDOResource)container).cdoID());
+ revision.setContainerID(CDOID.NULL);
+ revision.setContainingFeature(0);
+ }
+ else
+ {
+ revision.setResourceID(CDOID.NULL);
+ CDOID containerID = view.provideCDOID(container);
+ if (containerID.isNull())
+ {
+ throw new ImplementationError("containerID.isNull()");
+ }
+
+ int containerFeatureID = target.eContainerFeatureID();// containER???
+ revision.setContainerID(containerID);
+ revision.setContainingFeature(containerFeatureID);
+ }
+ }
+
+ // Handle values
CDOClassImpl cdoClass = revision.getCDOClass();
CDOFeatureImpl[] features = cdoClass.getAllFeatures();
for (int i = 0; i < features.length; i++)
@@ -322,6 +351,23 @@ public class CDOAdapterImpl extends AdapterImpl implements InternalCDOObject
{
InternalEObject target = getTarget();
CDOViewImpl view = cdoView();
+
+ // Handle containment
+ CDOID containerID = revision.getContainerID();
+ if (containerID.isNull())
+ {
+ CDOID resourceID = revision.getResourceID();
+ Resource.Internal resource = (Resource.Internal)view.lookupInstance(resourceID);
+ ((BasicEObjectImpl)target).eSetResource(resource, null);
+ }
+ else
+ {
+ int containingFeatureID = revision.getContainingFeatureID();
+ InternalCDOObject container = view.lookupInstance(containerID);
+ ((BasicEObjectImpl)target).eBasicSetContainer(container, containingFeatureID, null);
+ }
+
+ // Handle values
CDOClassImpl cdoClass = revision.getCDOClass();
CDOFeatureImpl[] features = cdoClass.getAllFeatures();
for (int i = 0; i < features.length; i++)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
index 104da6f..2703af0 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
@@ -145,7 +145,7 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier
{
if (resourceID == null || resourceID == CDOID.NULL)
{
- throw new ImplementationError("resourceID == null || resourceID == CDOID.NULL");
+ throw new IllegalArgumentException("resourceID == null || resourceID == CDOID.NULL");
}
ResourceSet resourceSet = getResourceSet();
@@ -245,7 +245,9 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier
}
else
{
- object.cdoInternalSetResource(getResource(revision.getResourceID()));
+ CDOID resourceID = revision.getResourceID();
+ CDOResourceImpl resource = getResource(resourceID);
+ object.cdoInternalSetResource(resource);
}
object.cdoInternalSetView(this);