Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkhussey2006-05-25 16:42:17 +0000
committerkhussey2006-05-25 16:42:17 +0000
commit56f7b86e5243a97eb197743fe7f391f4d992b715 (patch)
tree4860b96e5a57aa6ce9a3221dd60933b12dc45841
parentd6d05f3897baaf8e6ea5b987dd75a19c0bd4fecd (diff)
downloadorg.eclipse.uml2.test-56f7b86e5243a97eb197743fe7f391f4d992b715.tar.gz
org.eclipse.uml2.test-56f7b86e5243a97eb197743fe7f391f4d992b715.tar.xz
org.eclipse.uml2.test-56f7b86e5243a97eb197743fe7f391f4d992b715.zip
[143746] Enhancing importer to handle *.uml2 and *.xmi files as well.build_200605251244
-rw-r--r--plugins/org.eclipse.uml2.uml.ecore.importer/plugin.properties6
-rw-r--r--plugins/org.eclipse.uml2.uml.ecore.importer/plugin.xml4
-rw-r--r--plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/UMLImporter.java27
-rw-r--r--plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/ui/UMLImporterDetailPage.java8
4 files changed, 36 insertions, 9 deletions
diff --git a/plugins/org.eclipse.uml2.uml.ecore.importer/plugin.properties b/plugins/org.eclipse.uml2.uml.ecore.importer/plugin.properties
index 8df60695..92b1a097 100644
--- a/plugins/org.eclipse.uml2.uml.ecore.importer/plugin.properties
+++ b/plugins/org.eclipse.uml2.uml.ecore.importer/plugin.properties
@@ -7,7 +7,7 @@
# Contributors:
# IBM - initial API and implementation
#
-# $Id: plugin.properties,v 1.1 2006/02/09 01:25:21 khussey Exp $
+# $Id: plugin.properties,v 1.2 2006/05/25 16:42:17 khussey Exp $
# NLS_MESSAGEFORMAT_VAR
@@ -30,8 +30,8 @@ _UI_UMLImporter_label = UML model
_UI_UMLModelImporter_description = Creates ecore and genmodel files based on a UML model
_UI_UMLImport_title = UML Import
-_UI_UMLImportFile_description = Choose options, specify one or more '.uml' URIs, and try to load them
-_UI_UMLImportNewProject_description = Choose options, specify one or more '.uml' URIs, try to load them, and choose a target generator model name
+_UI_UMLImportFile_description = Choose options, specify one or more URIs, and try to load them
+_UI_UMLImportNewProject_description = Choose options, specify one or more URIs, try to load them, and choose a target generator model name
_UI_ErrorsWereDetectedUML_message = Problems were detected while validating and converting the UML models
_UI_SpecifyAValidUMLModel_message = Specify a valid UML model and try loading again
diff --git a/plugins/org.eclipse.uml2.uml.ecore.importer/plugin.xml b/plugins/org.eclipse.uml2.uml.ecore.importer/plugin.xml
index 34bf9657..3781a09e 100644
--- a/plugins/org.eclipse.uml2.uml.ecore.importer/plugin.xml
+++ b/plugins/org.eclipse.uml2.uml.ecore.importer/plugin.xml
@@ -11,7 +11,7 @@
Contributors:
IBM - initial API and implementation
- $Id: plugin.xml,v 1.1 2006/02/09 01:25:21 khussey Exp $
+ $Id: plugin.xml,v 1.2 2006/05/25 16:42:17 khussey Exp $
-->
<plugin>
@@ -21,7 +21,7 @@
id="org.eclipse.uml2.uml.ecore.importer"
name="%_UI_UMLImporter_label"
icon="platform:/plugin/org.eclipse.uml2.uml.editor/icons/full/obj16/UMLModelFile.gif"
- extensions="uml"
+ extensions="uml,uml2,xmi"
description="%_UI_UMLModelImporter_description"
wizard="org.eclipse.uml2.uml.ecore.importer.ui.UMLImporterWizard"/>
</extension>
diff --git a/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/UMLImporter.java b/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/UMLImporter.java
index cb1c3f3c..d851737c 100644
--- a/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/UMLImporter.java
+++ b/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/UMLImporter.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: UMLImporter.java,v 1.2 2006/04/06 12:56:54 khussey Exp $
+ * $Id: UMLImporter.java,v 1.3 2006/05/25 16:42:17 khussey Exp $
*/
package org.eclipse.uml2.uml.ecore.importer;
@@ -42,7 +42,10 @@ import org.eclipse.uml2.common.util.UML2Util;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.resource.UML22UMLExtendedMetaData;
+import org.eclipse.uml2.uml.resource.UML22UMLResource;
import org.eclipse.uml2.uml.resource.UMLResource;
+import org.eclipse.uml2.uml.resource.XMI2UMLResource;
import org.eclipse.uml2.uml.util.UMLUtil;
public class UMLImporter
@@ -249,7 +252,10 @@ public class UMLImporter
String value = (String) i.next();
- if (value.endsWith('.' + UMLResource.FILE_EXTENSION)) {
+ if (value.endsWith('.' + UMLResource.FILE_EXTENSION)
+ || value.endsWith('.' + UML22UMLResource.FILE_EXTENSION)
+ || value.endsWith('.' + XMI2UMLResource.FILE_EXTENSION)) {
+
text.append(makeAbsolute(URI.createURI(value), genModelURI)
.toString());
text.append(" "); //$NON-NLS-1$
@@ -271,4 +277,21 @@ public class UMLImporter
getOptions());
}
+ public ResourceSet createResourceSet() {
+ ResourceSet resourceSet = super.createResourceSet();
+
+ Map extensionToFactoryMap = resourceSet.getResourceFactoryRegistry()
+ .getExtensionToFactoryMap();
+
+ extensionToFactoryMap.put(UML22UMLResource.FILE_EXTENSION,
+ UML22UMLResource.Factory.INSTANCE);
+ extensionToFactoryMap.put(XMI2UMLResource.FILE_EXTENSION,
+ XMI2UMLResource.Factory.INSTANCE);
+
+ resourceSet.getURIConverter().getURIMap().putAll(
+ UML22UMLExtendedMetaData.getURIMap());
+
+ return resourceSet;
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/ui/UMLImporterDetailPage.java b/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/ui/UMLImporterDetailPage.java
index c6693e74..0fe9cd11 100644
--- a/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/ui/UMLImporterDetailPage.java
+++ b/plugins/org.eclipse.uml2.uml.ecore.importer/src/org/eclipse/uml2/uml/ecore/importer/ui/UMLImporterDetailPage.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: UMLImporterDetailPage.java,v 1.2 2006/05/18 17:54:28 khussey Exp $
+ * $Id: UMLImporterDetailPage.java,v 1.3 2006/05/25 16:42:17 khussey Exp $
*/
package org.eclipse.uml2.uml.ecore.importer.ui;
@@ -37,7 +37,9 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.uml2.uml.ecore.importer.UMLImporter;
import org.eclipse.uml2.uml.ecore.importer.UMLImporterPlugin;
+import org.eclipse.uml2.uml.resource.UML22UMLResource;
import org.eclipse.uml2.uml.resource.UMLResource;
+import org.eclipse.uml2.uml.resource.XMI2UMLResource;
import org.eclipse.uml2.uml.util.UMLUtil;
public class UMLImporterDetailPage
@@ -242,6 +244,8 @@ public class UMLImporterDetailPage
}
protected String[] getFilterExtensions() {
- return new String[]{"*." + UMLResource.FILE_EXTENSION}; //$NON-NLS-1$
+ return new String[]{
+ "*." + UMLResource.FILE_EXTENSION, "*." + UML22UMLResource.FILE_EXTENSION, "*." + XMI2UMLResource.FILE_EXTENSION}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
+
} \ No newline at end of file

Back to the top