Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenn Hussey2012-03-06 14:28:46 +0000
committerKenn Hussey2012-03-06 14:28:46 +0000
commitf4ca0480631126f4bbebd0bdeec899edaac09346 (patch)
tree09ae7840af23a2ded4c89f1825088380aec88d24 /plugins/org.eclipse.uml2.uml
parent6a2149043a345e51ad70d0799b930fe4a8f8677d (diff)
downloadorg.eclipse.uml2.test-f4ca0480631126f4bbebd0bdeec899edaac09346.tar.gz
org.eclipse.uml2.test-f4ca0480631126f4bbebd0bdeec899edaac09346.tar.xz
org.eclipse.uml2.test-f4ca0480631126f4bbebd0bdeec899edaac09346.zip
[369492] Fixing migration of enum attributes for static profiles.
Diffstat (limited to 'plugins/org.eclipse.uml2.uml')
-rw-r--r--plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/PackageOperations.java44
1 files changed, 28 insertions, 16 deletions
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/PackageOperations.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/PackageOperations.java
index bbddcb59..fced1d78 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/PackageOperations.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/PackageOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011 IBM Corporation, Embarcadero Technologies, CEA, and others.
+ * Copyright (c) 2005, 2012 IBM Corporation, Embarcadero Technologies, CEA, and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,7 +9,7 @@
* IBM - initial API and implementation
* Kenn Hussey (Embarcadero Technologies) - 271470
* Kenn Hussey - 323181, 348433
- * Kenn Hussey (CEA) - 327039
+ * Kenn Hussey (CEA) - 327039, 369492
*
* $Id: PackageOperations.java,v 1.41 2010/09/28 21:02:15 khussey Exp $
*/
@@ -24,6 +24,7 @@ import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.common.util.ECollections;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.Enumerator;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.UniqueEList;
@@ -215,39 +216,50 @@ public class PackageOperations
if (targetEAttribute.isMany()) {
@SuppressWarnings("unchecked")
- EList<EEnumLiteral> copyValues = (EList<EEnumLiteral>) copyEObject
+ EList<Enumerator> copyValues = (EList<Enumerator>) copyEObject
.eGet(targetEAttribute);
if (eAttribute.isMany()) {
@SuppressWarnings("unchecked")
- EList<EEnumLiteral> values = (EList<EEnumLiteral>) eObject
+ EList<Enumerator> values = (EList<Enumerator>) eObject
.eGet(eAttribute);
for (int i = 0, size = values.size(); i < size; i++) {
- EEnumLiteral value = targetEEnum
+ EEnumLiteral targetEEnumLiteral = targetEEnum
.getEEnumLiteral(values.get(i).getName());
- if (value != null) {
- copyValues.add(value);
+ if (targetEEnumLiteral != null) {
+ copyValues
+ .add(targetEEnumLiteral.getInstance());
}
}
} else {
- EEnumLiteral value = targetEEnum
- .getEEnumLiteral(((EEnumLiteral) eObject
- .eGet(eAttribute)).getName());
+ Enumerator value = (Enumerator) eObject
+ .eGet(eAttribute);
if (value != null) {
- copyValues.add(value);
+ EEnumLiteral targetEEnumLiteral = targetEEnum
+ .getEEnumLiteral(value.getName());
+
+ if (targetEEnumLiteral != null) {
+ copyValues
+ .add(targetEEnumLiteral.getInstance());
+ }
}
}
} else {
- EEnumLiteral value = targetEEnum
- .getEEnumLiteral(((EEnumLiteral) (eAttribute.isMany()
- ? ((EList<?>) eObject.eGet(eAttribute)).get(0)
- : eObject.eGet(eAttribute))).getName());
+ Enumerator value = (Enumerator) (eAttribute.isMany()
+ ? ((EList<?>) eObject.eGet(eAttribute)).get(0)
+ : eObject.eGet(eAttribute));
if (value != null) {
- copyEObject.eSet(targetEAttribute, value);
+ EEnumLiteral targetEEnumLiteral = targetEEnum
+ .getEEnumLiteral(value.getName());
+
+ if (targetEEnumLiteral != null) {
+ copyEObject.eSet(targetEAttribute,
+ targetEEnumLiteral.getInstance());
+ }
}
}
}

Back to the top