Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Noyrit2015-01-20 14:03:00 +0000
committerFlorian Noyrit2015-01-20 14:03:00 +0000
commit6421409abb6b40300cd4978f304b0e50d7974f65 (patch)
treee2ca947494ad64c462535ad057302f4bb28c754f /plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer
parenta4af896d6a42ef056a3ceead321aa7ce848aa0f5 (diff)
downloadorg.eclipse.papyrus-6421409abb6b40300cd4978f304b0e50d7974f65.tar.gz
org.eclipse.papyrus-6421409abb6b40300cd4978f304b0e50d7974f65.tar.xz
org.eclipse.papyrus-6421409abb6b40300cd4978f304b0e50d7974f65.zip
Migrated UML Class Diagram to ElementType registry.
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer')
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/handlers/GenerateElementTypesConfigurationsFromGmfGen.java44
1 files changed, 42 insertions, 2 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/handlers/GenerateElementTypesConfigurationsFromGmfGen.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/handlers/GenerateElementTypesConfigurationsFromGmfGen.java
index 009eabd0a82..bc6a31da97c 100644
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/handlers/GenerateElementTypesConfigurationsFromGmfGen.java
+++ b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/handlers/GenerateElementTypesConfigurationsFromGmfGen.java
@@ -31,6 +31,7 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.gmf.codegen.gmfgen.FeatureLinkModelFacet;
import org.eclipse.gmf.codegen.gmfgen.GenCommonBase;
+import org.eclipse.gmf.codegen.gmfgen.NotationType;
import org.eclipse.gmf.codegen.gmfgen.TypeModelFacet;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -69,16 +70,21 @@ public class GenerateElementTypesConfigurationsFromGmfGen extends AbstractHandle
Resource inputResource = resourceSet.getResource(URI.createURI(selectedFilePath), true);
- Resource outputResource = resourceSet.createResource(URI.createURI(selectedFilePath + ".elementtypesconfigurations"));
+ String outputFilePath = ((IFile) selectedElement).getFullPath().removeFileExtension().toString();
+ Resource outputResource = resourceSet.createResource(URI.createURI(outputFilePath + ".elementtypesconfigurations"));
ElementTypeSetConfiguration elementTypeSetConfiguration = generateElementTypeSetConfiguration(inputResource);
-
+ Resource outputNotationResource = resourceSet.createResource(URI.createURI(outputFilePath + "-notation.elementtypesconfigurations"));
+ ElementTypeSetConfiguration elementTypeSetConfigurationNotation = generateElementTypeSetConfigurationNotation(inputResource);
outputResource.getContents().add(elementTypeSetConfiguration);
+ outputNotationResource.getContents().add(elementTypeSetConfigurationNotation);
ECollections.sort(((ElementTypeSetConfiguration) outputResource.getContents().get(0)).getElementTypeConfigurations(), new ElementTypeConfigurationComparator());
+ ECollections.sort(((ElementTypeSetConfiguration) outputNotationResource.getContents().get(0)).getElementTypeConfigurations(), new ElementTypeConfigurationComparator());
try {
outputResource.save(Collections.EMPTY_MAP);
+ outputNotationResource.save(Collections.EMPTY_MAP);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -87,8 +93,42 @@ public class GenerateElementTypesConfigurationsFromGmfGen extends AbstractHandle
return null;
}
+ protected ElementTypeSetConfiguration generateElementTypeSetConfigurationNotation(Resource inputResource) {
+ ElementTypeSetConfiguration elementTypeSetConfiguration = ElementtypesconfigurationsFactory.eINSTANCE.createElementTypeSetConfiguration();
+ elementTypeSetConfiguration.setMetamodelNsURI("http://www.eclipse.org/gmf/runtime/1.0.2/notation");
+
+
+ TreeIterator<EObject> it = inputResource.getAllContents();
+ while (it.hasNext()) {
+ EObject eObject = (EObject) it.next();
+ if (eObject instanceof NotationType) {
+ NotationType notationType = (NotationType) eObject;
+
+
+
+ SpecializationTypeConfiguration specializationTypeConfiguration = ElementtypesconfigurationsFactory.eINSTANCE.createSpecializationTypeConfiguration();
+
+ specializationTypeConfiguration.setIdentifier(notationType.getUniqueIdentifier());
+ specializationTypeConfiguration.setHint("" + ((GenCommonBase) notationType.eContainer()).getVisualID());
+ specializationTypeConfiguration.setName(notationType.getDisplayName());
+
+ specializationTypeConfiguration.setKind("org.eclipse.gmf.runtime.diagram.ui.util.INotationType");
+
+ specializationTypeConfiguration.getSpecializedTypesID().add("org.eclipse.gmf.runtime.emf.type.core.null");
+
+ elementTypeSetConfiguration.getElementTypeConfigurations().add(specializationTypeConfiguration);
+
+
+ }
+ }
+
+ return elementTypeSetConfiguration;
+ }
+
protected ElementTypeSetConfiguration generateElementTypeSetConfiguration(Resource inputResource) {
ElementTypeSetConfiguration elementTypeSetConfiguration = ElementtypesconfigurationsFactory.eINSTANCE.createElementTypeSetConfiguration();
+ elementTypeSetConfiguration.setMetamodelNsURI("http://www.eclipse.org/uml2/5.0.0/UML");
+
TreeIterator<EObject> it = inputResource.getAllContents();
while (it.hasNext()) {

Back to the top