Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-06-24 09:47:38 +0000
committerEike Stepper2011-06-24 09:47:38 +0000
commite95fce16711e27b06e8016e972f9badeb94bff7d (patch)
tree071b7e333bfe940ca2e23ea46cd2ee9bba5befce
parent1e938f8c75389cec59bb9deff71e9311d0f9ab93 (diff)
downloadcdo-e95fce16711e27b06e8016e972f9badeb94bff7d.tar.gz
cdo-e95fce16711e27b06e8016e972f9badeb94bff7d.tar.xz
cdo-e95fce16711e27b06e8016e972f9badeb94bff7d.zip
[350015] Ensure that EMF pre 2.6 does not prevent CDO usage
https://bugs.eclipse.org/bugs/show_bug.cgi?id=350015
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyAdapter.java52
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyWrapper.java20
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOObjectWrapper.java42
3 files changed, 56 insertions, 58 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyAdapter.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyAdapter.java
index 2bc24043de..36477ec3c4 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyAdapter.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyAdapter.java
@@ -15,12 +15,17 @@ import org.eclipse.emf.cdo.CDONotification;
import org.eclipse.emf.cdo.common.model.EMFUtil;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.internal.cdo.bundle.OM;
+
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.spi.cdo.CDOStore;
+import org.eclipse.emf.spi.cdo.FSMUtil;
import java.util.List;
@@ -30,12 +35,18 @@ import java.util.List;
*/
public class CDOLegacyAdapter extends CDOLegacyWrapper implements Adapter.Internal
{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_OBJECT, CDOLegacyAdapter.class);
+
/**
* @since 3.0
*/
public CDOLegacyAdapter(InternalEObject object)
{
super(object);
+
+ instance.eAdapters().add(this);
+ ((org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EObservableAdapterList)instance.eAdapters())
+ .addListener(new AdapterListListener());
}
public void setTarget(Notifier newTarget)
@@ -132,4 +143,45 @@ public class CDOLegacyAdapter extends CDOLegacyWrapper implements Adapter.Intern
instanceToRevisionContainment();
}
}
+
+ /**
+ * @author Martin Flügge
+ * @since 3.0
+ */
+ protected class AdapterListListener implements
+ org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EObservableAdapterList.Listener
+ {
+ /**
+ * @since 4.0
+ */
+ public AdapterListListener()
+ {
+ }
+
+ public void added(Notifier notifier, Adapter adapter)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Added : {0} to {1} ", adapter, CDOLegacyAdapter.this); //$NON-NLS-1$
+ }
+
+ if (!FSMUtil.isTransient(CDOLegacyAdapter.this))
+ {
+ cdoView().handleAddAdapter(CDOLegacyAdapter.this, adapter);
+ }
+ }
+
+ public void removed(Notifier notifier, Adapter adapter)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Removed : {0} from {1} ", adapter, CDOLegacyAdapter.this); //$NON-NLS-1$
+ }
+
+ if (!FSMUtil.isTransient(CDOLegacyAdapter.this))
+ {
+ cdoView().handleRemoveAdapter(CDOLegacyAdapter.this, adapter);
+ }
+ }
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyWrapper.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyWrapper.java
index 3a6d975c36..3678c01d21 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyWrapper.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyWrapper.java
@@ -37,7 +37,6 @@ import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EObservableAdapterList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EAttribute;
@@ -110,9 +109,6 @@ public abstract class CDOLegacyWrapper extends CDOObjectWrapper
{
this.instance = instance;
state = CDOState.TRANSIENT;
-
- instance.eAdapters().add((Adapter)this);
- attachAdapterListListener();
}
public CDOState cdoState()
@@ -165,7 +161,7 @@ public abstract class CDOLegacyWrapper extends CDOObjectWrapper
{
if (TRACER.isEnabled())
{
- TRACER.trace(("Setting revision: " + revision)); //$NON-NLS-1$
+ TRACER.trace("Setting revision: " + revision); //$NON-NLS-1$
}
this.revision = (InternalCDORevision)revision;
@@ -317,14 +313,6 @@ public abstract class CDOLegacyWrapper extends CDOObjectWrapper
return "CDOLegacyWrapper[" + instance.getClass().getSimpleName() + "@" + id + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- /**
- * @since 3.0
- */
- protected void attachAdapterListListener()
- {
- ((EObservableAdapterList)instance.eAdapters()).addListener(new AdapterListListener());
- }
-
protected void instanceToRevision()
{
if (TRACER.isEnabled())
@@ -503,7 +491,7 @@ public abstract class CDOLegacyWrapper extends CDOObjectWrapper
{
if (TRACER.isEnabled())
{
- TRACER.format(("Setting attribute value " + object + " to feature " + feature + " in instance " + instance)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ TRACER.format("Setting attribute value " + object + " to feature " + feature + " in instance " + instance); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
// Just fake it for the store :(
@@ -521,7 +509,7 @@ public abstract class CDOLegacyWrapper extends CDOObjectWrapper
// EReferences
if (TRACER.isEnabled())
{
- TRACER.format(("Adding object " + object + " to feature " + feature + " in instance " + instance)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ TRACER.format("Adding object " + object + " to feature " + feature + " in instance " + instance); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
int featureID = instance.eClass().getFeatureID(feature);
@@ -563,7 +551,7 @@ public abstract class CDOLegacyWrapper extends CDOObjectWrapper
if (TRACER.isEnabled())
{
- TRACER.format(("Added object " + object + " to feature " + feature + " in instance " + instance)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ TRACER.format("Added object " + object + " to feature " + feature + " in instance " + instance); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOObjectWrapper.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOObjectWrapper.java
index 4a777eaff1..145b6264f5 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOObjectWrapper.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOObjectWrapper.java
@@ -23,7 +23,6 @@ import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
@@ -448,45 +447,4 @@ public abstract class CDOObjectWrapper implements InternalCDOObject
{
return instance.eURIFragmentSegment(feature, object);
}
-
- /**
- * @author Martin Flügge
- * @since 3.0
- */
- protected class AdapterListListener implements
- org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EObservableAdapterList.Listener
- {
- /**
- * @since 4.0
- */
- public AdapterListListener()
- {
- }
-
- public void added(Notifier notifier, Adapter adapter)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Added : {0} to {1} ", adapter, CDOObjectWrapper.this); //$NON-NLS-1$
- }
-
- if (!FSMUtil.isTransient(CDOObjectWrapper.this))
- {
- cdoView().handleAddAdapter(CDOObjectWrapper.this, adapter);
- }
- }
-
- public void removed(Notifier notifier, Adapter adapter)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Removed : {0} from {1} ", adapter, CDOObjectWrapper.this); //$NON-NLS-1$
- }
-
- if (!FSMUtil.isTransient(CDOObjectWrapper.this))
- {
- cdoView().handleRemoveAdapter(CDOObjectWrapper.this, adapter);
- }
- }
- }
}

Back to the top