Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 153867 Details for
Bug 247226
Transparently support legacy models (CDOLegacyAdapter)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
LegacyAdapter Patch V3
patch.txt (text/plain), 5.75 KB, created by
Martin Fluegge
on 2009-12-05 14:21:51 EST
(
hide
)
Description:
LegacyAdapter Patch V3
Filename:
MIME Type:
Creator:
Martin Fluegge
Created:
2009-12-05 14:21:51 EST
Size:
5.75 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.emf.cdo >Index: src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.cdo/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java,v >retrieving revision 1.32 >diff -u -r1.32 CDOLegacyWrapper.java >--- src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java 10 Nov 2009 09:23:28 -0000 1.32 >+++ src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java 5 Dec 2009 19:20:13 -0000 >@@ -30,7 +30,6 @@ > import org.eclipse.net4j.util.om.trace.ContextTracer; > > import org.eclipse.emf.common.notify.Adapter; >-import org.eclipse.emf.common.notify.impl.NotifyingListImpl; > import org.eclipse.emf.common.util.URI; > import org.eclipse.emf.ecore.EAttribute; > import org.eclipse.emf.ecore.EClass; >@@ -358,7 +357,6 @@ > > // if (state != CDOState.CONFLICT) // do not do anything with the > if (state == CDOState.CLEAN || state == CDOState.PROXY) // do not do anything with the >- // list if state is conflict > { > // int size = view.getStore().size(instance, feature); > int size = revision.size(feature); >@@ -403,7 +401,24 @@ > > int featureID = instance.eClass().getFeatureID(feature); > Class<? extends Object> baseClass = object == null ? null : object.getClass(); >- instance.eInverseAdd((InternalEObject)object, featureID, baseClass, null); >+ try >+ { >+ instance.eInverseAdd((InternalEObject)object, featureID, baseClass, null); >+ } >+ catch (NullPointerException e) >+ {// TODO: Martin:quick hack, because there is still a problem with the feature id. Should investigate this soon >+ System.out.println("Feature: " + feature); >+ >+ instance.eSet(feature, object); >+ } >+ >+ // adjust opposite for transient opposite features >+ EStructuralFeature.Internal internalFeature = (EStructuralFeature.Internal)feature; >+ EReference oppositeReference = cdoID().isTemporary() ? null : internalFeature.getEOpposite(); >+ if (oppositeReference != null && object != null) >+ { >+ adjustOppositeReference(instance, (InternalEObject)object, oppositeReference); >+ } > > if (TRACER.isEnabled()) > { >@@ -413,6 +428,41 @@ > } > } > >+ private void adjustOppositeReference(InternalEObject instance, InternalEObject object, EReference oppositeReference) >+ { >+ System.out.println("Adjusting opposite for : instance: " + instance + " object:" + object + " reference: " >+ + oppositeReference); >+ >+ boolean deliver = object.eDeliver(); // disable notifications >+ if (deliver) >+ { >+ object.eSetDeliver(false); >+ } >+ try >+ { >+ if (oppositeReference.isMany()) >+ { >+ // TODO Martin: is this enough?? >+ ((InternalEList<Object>)object.eGet(oppositeReference)).basicAdd(instance, null); >+ } >+ else >+ { >+ // TODO Martin: this only increases performance if getter is cheaper than setter. Should discuss this. >+ if (object.eGet(oppositeReference) != instance) >+ { >+ object.eInverseAdd(instance, oppositeReference.getFeatureID(), ((EObject)instance).getClass(), null); >+ } >+ } >+ } >+ finally >+ { >+ if (deliver) >+ { >+ object.eSetDeliver(true); >+ } >+ } >+ } >+ > private void clearList(EStructuralFeature feature, InternalEList<Object> list) > { > // attempt 2 >@@ -421,7 +471,11 @@ > { > InternalEObject obj = (InternalEObject)list.get(i); > // TODO clarify obj.getClass()/baseclass >- instance.eInverseRemove(obj, featureID, obj.getClass(), null); >+ ((InternalEList<?>)list).basicRemove(obj, null); >+ //TODO Martin: baseicRemove seems to be better than eInverseremove >+ >+ // instance.eInverseRemove(obj, featureID, obj.getClass(), null); >+ > } > } > >@@ -572,8 +626,7 @@ > * at runtime. Note also that the proxy object might even not be cast to the concrete type of the target object. The > * proxy can only guaranteed to be of <em>any</em> concrete subtype of the declared type of the given feature. > * <p> >- * TODO {@link InternalEObject#eResolveProxy(InternalEObject) >- */ >+ * TODO {@link InternalEObject#eResolveProxy(InternalEObject) */ > protected InternalEObject createProxy(InternalCDOView view, EStructuralFeature feature, CDOID id) > { > EClassifier eType = feature.getEType(); >@@ -632,6 +685,13 @@ > @SuppressWarnings("unchecked") > InternalEList<Object> list = (InternalEList<Object>)value; > int size = list.size(); >+ >+ boolean deliver = instance.eDeliver(); >+ if (deliver) >+ { >+ instance.eSetDeliver(false); >+ } >+ > for (int i = 0; i < size; i++) > { > Object element = list.get(i); >@@ -650,16 +710,21 @@ > // ((org.eclipse.emf.ecore.util.DelegatingInternalEList)list).getDelegateInternalEList(); > // } > >- if (list instanceof NotifyingListImpl<?>) >- { >- ((NotifyingListImpl<Object>)list).basicSet(i, instance, null); >- } >- else >- { >- list.set(i, instance); >- } >+ // if (list instanceof NotifyingListImpl<?>) >+ // { >+ // ((NotifyingListImpl<Object>)list).basicSet(i, instance, null); >+ // } >+ // else >+ // { >+ list.set(i, instance); >+ // } > } > } >+ if (deliver) >+ { >+ instance.eSetDeliver(true); >+ } >+ > } > else > {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 247226
:
112514
|
112894
|
134866
|
151009
|
151634
|
151651
|
152232
|
153867
|
153868
|
155030
|
155031
|
155181
|
155182
|
155400
|
163497
|
163499