Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenn Hussey2011-10-06 21:18:14 +0000
committerKenn Hussey2011-10-06 21:18:14 +0000
commit9a2323703441f0c0b0d5a077338700a8a77b61b0 (patch)
tree01f2d921d87e6b7be7199eecdd78da60872cb78a /plugins/org.eclipse.uml2.uml
parent77778fdd9f67c845df808c801d21f15c99d24c38 (diff)
downloadorg.eclipse.uml2.test-9a2323703441f0c0b0d5a077338700a8a77b61b0.tar.gz
org.eclipse.uml2.test-9a2323703441f0c0b0d5a077338700a8a77b61b0.tar.xz
org.eclipse.uml2.test-9a2323703441f0c0b0d5a077338700a8a77b61b0.zip
[359964] Working around issues with hosted OMG resources for UML and
MOF.
Diffstat (limited to 'plugins/org.eclipse.uml2.uml')
-rw-r--r--plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/XMI2UMLHandler.java74
1 files changed, 73 insertions, 1 deletions
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/XMI2UMLHandler.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/XMI2UMLHandler.java
index d7dff801..c1ef4ba6 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/XMI2UMLHandler.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/XMI2UMLHandler.java
@@ -8,20 +8,29 @@
* Contributors:
* IBM - initial API and implementation
* Kenn Hussey (Embarcadero Technologies) - 199624, 204202
- * Kenn Hussey (CEA) - 327039
+ * Kenn Hussey (CEA) - 327039, 359964
*
*/
package org.eclipse.uml2.uml.internal.resource;
import java.util.Map;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EFactory;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.xmi.XMIResource;
import org.eclipse.emf.ecore.xmi.XMLHelper;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.emf.ecore.xmi.impl.EMOFExtendedMetaData;
+
+import org.eclipse.uml2.types.TypesPackage;
+import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.resource.UMLResource;
import org.eclipse.uml2.uml.resource.XMI2UMLResource;
@@ -132,4 +141,67 @@ public class XMI2UMLHandler
}
}
+ @Override
+ protected void setFeatureValue(EObject object, EStructuralFeature feature,
+ Object value, int position) {
+
+ if (feature == UMLPackage.Literals.INSTANCE_SPECIFICATION__CLASSIFIER && object instanceof EnumerationLiteral) {
+ return;
+ }
+
+ super.setFeatureValue(object, feature, value, position);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ protected EObject validateCreateObjectFromFactory(EFactory factory,
+ String typeName, EObject newObject, EStructuralFeature feature) {
+
+ if (newObject == null
+ && feature == UMLPackage.Literals.TYPED_ELEMENT__TYPE) {
+
+ if (attribs != null) {
+
+ for (int i = 0, size = attribs.getLength(); i < size; ++i) {
+
+ if (attribs.getQName(i).equals(hrefAttribute)) {
+ String uriLiteral = attribs.getValue(i);
+
+ if (uriLiteral
+ .startsWith(XMI2UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_URI)) {
+
+ int index = uriLiteral.indexOf('#');
+
+ if (index != -1
+ && TypesPackage.eINSTANCE
+ .getEClassifier(uriLiteral.substring(index + 1)) instanceof EDataType) {
+ factory = UMLFactory.eINSTANCE;
+ newObject = createObjectFromFactory(factory,
+ UMLPackage.Literals.PRIMITIVE_TYPE
+ .getName());
+ }
+ } else if (uriLiteral
+ .startsWith(XMI2UMLResource.UML_METAMODEL_URI)) {
+
+ int index = uriLiteral.indexOf('#');
+
+ if (index != -1
+ && UMLPackage.eINSTANCE
+ .getEClassifier(uriLiteral.substring(index + 1)) instanceof EClass) {
+ factory = UMLFactory.eINSTANCE;
+ newObject = createObjectFromFactory(factory,
+ UMLPackage.Literals.CLASS.getName());
+ }
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ return super.validateCreateObjectFromFactory(factory, typeName,
+ newObject, feature);
+ }
+
}

Back to the top