https://bugs.eclipse.org/bugs/show_bug.cgi?id=69692
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ElementImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ElementImpl.java
index e580887..8ad16be 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ElementImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ElementImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: ElementImpl.java,v 1.15 2004/06/03 02:59:18 khussey Exp $
+ * $Id: ElementImpl.java,v 1.15.2.1 2004/07/14 20:09:00 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -29,6 +29,7 @@
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.EModelElementImpl;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.resource.Resource.Internal;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EcoreEList;
import org.eclipse.emf.ecore.util.InternalEList;
@@ -84,7 +85,7 @@
protected ElementImpl() {
super();
- eAdapters().add(getCacheAdapter());
+ getCacheAdapter().adapt(this);
}
/**
@@ -348,6 +349,20 @@
/*
* (non-Javadoc)
*
+ * @see org.eclipse.emf.ecore.InternalEObject#eSetResource(org.eclipse.emf.ecore.resource.Resource.Internal,
+ * org.eclipse.emf.common.notify.NotificationChain)
+ */
+ public NotificationChain eSetResource(Internal resource,
+ NotificationChain notifications) {
+
+ getCacheAdapter().adapt(resource);
+
+ return super.eSetResource(resource, notifications);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.uml2.Element#createEAnnotation(String)
*/
public EAnnotation createEAnnotation(String source) {
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ProfileOperations.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ProfileOperations.java
index 73fa2b8..37f73b6 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ProfileOperations.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ProfileOperations.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: ProfileOperations.java,v 1.8.2.1 2004/07/14 15:24:30 khussey Exp $
+ * $Id: ProfileOperations.java,v 1.8.2.2 2004/07/14 20:09:00 khussey Exp $
*/
package org.eclipse.uml2.internal.operation;
@@ -161,7 +161,7 @@
EPackage ePackage = (EPackage) ePackages.next();
- if (version.equals(ePackage.getName().substring(
+ if (safeEquals(version, ePackage.getName().substring(
ePackage.getName().lastIndexOf('_') + 1))) {
return ePackage;
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/CacheAdapter.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/CacheAdapter.java
index 1716fbc..99c0c90 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/CacheAdapter.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/CacheAdapter.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*
- * $Id: CacheAdapter.java,v 1.6 2004/06/17 01:09:03 khussey Exp $
+ * $Id: CacheAdapter.java,v 1.6.2.1 2004/07/14 20:09:00 khussey Exp $
*/
package org.eclipse.uml2.util;
@@ -19,7 +19,9 @@
import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.resource.Resource;
@@ -35,6 +37,20 @@
private static final Map values = Collections
.synchronizedMap(new HashMap());
+ public boolean adapt(Notifier notifier) {
+
+ if (null != notifier) {
+ EList eAdapters = notifier.eAdapters();
+
+ if (!eAdapters.contains(this)) {
+ eAdapters.add(this);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
/*
* (non-Javadoc)
*
@@ -43,39 +59,31 @@
public void notifyChanged(Notification msg) {
super.notifyChanged(msg);
- Object feature = msg.getFeature();
-
- if (EcorePackage.eINSTANCE.getEModelElement_EAnnotations() == feature
- || EcorePackage.eINSTANCE.getEAnnotation_Details() == feature) {
-
- switch (msg.getEventType()) {
- case Notification.ADD :
- ((EObject) msg.getNewValue()).eAdapters().add(this);
- break;
- case Notification.ADD_MANY :
- for (Iterator newValues = ((List) msg.getNewValue())
- .iterator(); newValues.hasNext();) {
-
- ((EObject) newValues.next()).eAdapters().add(this);
- }
- break;
- case Notification.REMOVE :
- ((EObject) msg.getOldValue()).eAdapters().remove(this);
- break;
- case Notification.REMOVE_MANY :
- for (Iterator oldValues = ((List) msg.getOldValue())
- .iterator(); oldValues.hasNext();) {
-
- ((EObject) oldValues.next()).eAdapters().remove(this);
- }
- break;
- }
- }
-
Object notifier = msg.getNotifier();
if (EObject.class.isInstance(notifier)) {
+ Object feature = msg.getFeature();
+
+ if (EcorePackage.eINSTANCE.getEModelElement_EAnnotations() == feature
+ || EcorePackage.eINSTANCE.getEAnnotation_Details() == feature) {
+
+ switch (msg.getEventType()) {
+ case Notification.ADD :
+ adapt((Notifier) msg.getNewValue());
+ break;
+ case Notification.ADD_MANY :
+ for (Iterator newValues = ((List) msg.getNewValue())
+ .iterator(); newValues.hasNext();) {
+
+ adapt((Notifier) newValues.next());
+ }
+ break;
+ }
+ }
+
clear(((EObject) notifier).eResource());
+ } else if (Resource.class.isInstance(notifier)) {
+ clear((Resource) notifier);
}
clear();