Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML212UMLHandler.java')
-rw-r--r--plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML212UMLHandler.java50
1 files changed, 48 insertions, 2 deletions
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML212UMLHandler.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML212UMLHandler.java
index fe6a41f2..a84c5ff9 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML212UMLHandler.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML212UMLHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2011 IBM Corporation, 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
@@ -7,20 +7,23 @@
*
* Contributors:
* IBM - initial API and implementation
+ * Kenn Hussey (CEA) - 327039
*
- * $Id: UML212UMLHandler.java,v 1.2 2008/11/04 14:29:52 khussey Exp $
*/
package org.eclipse.uml2.uml.internal.resource;
import java.util.Map;
import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EFactory;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.xmi.XMLHelper;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.uml2.uml.resource.UML212UMLExtendedMetaData;
+import org.eclipse.uml2.uml.resource.UML302UMLResource;
/**
* Handler that converts .uml models.
@@ -32,6 +35,16 @@ import org.eclipse.uml2.uml.resource.UML212UMLExtendedMetaData;
public class UML212UMLHandler
extends UMLHandler {
+ protected static final String STANDARD_L3_PROFILE_NS_PREFIX = "l3"; //$NON-NLS-1$
+
+ protected static final String STANDARD_PROFILE_NS_PREFIX = "Standard"; //$NON-NLS-1$
+
+ protected static final String STEREOTYPE__BUILD_COMPONENT = "BuildComponent"; //$NON-NLS-1$
+
+ protected static final String STEREOTYPE__METAMODEL = "Metamodel"; //$NON-NLS-1$
+
+ protected static final String STEREOTYPE__SYSTEM_MODEL = "SystemModel"; //$NON-NLS-1$
+
public UML212UMLHandler(XMLResource xmiResource, XMLHelper helper,
Map<?, ?> options) {
super(xmiResource, helper, options);
@@ -73,4 +86,37 @@ public class UML212UMLHandler
}
}
+ @Override
+ protected EObject createObjectByType(String prefix, String name, boolean top) {
+ return super
+ .createObjectByType(
+ STANDARD_PROFILE_NS_PREFIX.equals(prefix)
+ && (STEREOTYPE__BUILD_COMPONENT.equals(name)
+ || STEREOTYPE__METAMODEL.equals(name) || STEREOTYPE__SYSTEM_MODEL
+ .equals(name))
+ ? STANDARD_L3_PROFILE_NS_PREFIX
+ : prefix, name, top);
+ }
+
+ @Override
+ protected EFactory getFactoryForPrefix(String prefix) {
+
+ if (STANDARD_L3_PROFILE_NS_PREFIX.equals(prefix)) {
+ EFactory factory = prefixesToFactories.get(prefix);
+
+ if (factory == null) {
+ EPackage ePackage = getPackageForURI(UML302UMLResource.STANDARD_L3_PROFILE_NS_URI);
+
+ if (ePackage != null) {
+ factory = ePackage.getEFactoryInstance();
+ prefixesToFactories.put(prefix, factory);
+ }
+ }
+
+ return factory;
+ }
+
+ return super.getFactoryForPrefix(prefix);
+ }
+
}

Back to the top