From 473ba87c30d8cf73c9b8612de5be4394902c8b57 Mon Sep 17 00:00:00 2001 From: Laurent Wouters Date: Fri, 4 Apr 2014 16:08:44 +0200 Subject: [clean] Retiring org.eclipse.papyrus.conversion.di2todi Signed-off-by: Laurent Wouters --- .../.classpath | 7 - .../.project | 34 -- .../META-INF/MANIFEST.MF | 28 - .../ClassAndProfileDiagEdgeVisualIDs.qvto | 39 -- .../ClassAndProfileDiagEdges.qvto | 280 --------- .../TransfoQvtoDi2toDi/ClassDiagNodes.qvto | 658 --------------------- .../TransfoQvtoDi2toDi/ClassDiagVisualIDs.qvto | 66 --- .../TransfoQvtoDi2toDi/CompositeDiagEdges.qvto | 162 ----- .../TransfoQvtoDi2toDi/CompositeDiagNodes.qvto | 284 --------- .../TransfoQvtoDi2toDi/CompositeDiagVisualIDs.qvto | 34 -- .../TransfoQvtoDi2toDi/DiTransformations.qvto | 103 ---- .../TransfoQvtoDi2toDi/Diagram.qvto | 213 ------- .../TransfoQvtoDi2toDi/ElementType.qvto | 25 - .../GeneralMappingsandHelpers.qvto | 136 ----- .../TransfoQvtoDi2toDi/NotationQueries.qvto | 168 ------ .../TransfoQvtoDi2toDi/ProfileDiagNodes.qvto | 273 --------- .../TransfoQvtoDi2toDi/ProfileDiagVisualIDs.qvto | 55 -- .../TransfoQvtoDi2toDi/StateDiagEdges.qvto | 160 ----- .../TransfoQvtoDi2toDi/StateDiagNodes.qvto | 308 ---------- .../TransfoQvtoDi2toDi/StateDiagVisualIDs.qvto | 84 --- .../TransfoQvtoDi2toDi/Transfo.qvto | 25 - .../build.properties | 6 - .../doc/TutorialConversion.html | 294 --------- .../doc/figs/conversion-example-di2action.png | Bin 23573 -> 0 bytes .../doc/figs/conversion-example-project.png | Bin 3998 -> 0 bytes .../doc/figs/conversion-example-result.png | Bin 5420 -> 0 bytes .../doc/figs/example-composite-diag-mdt.png | Bin 20800 -> 0 bytes .../doc/figs/example-composite-diag-p1.12.png | Bin 20127 -> 0 bytes .../doc/figs/example1-class-diagram-mdt.png | Bin 20393 -> 0 bytes .../doc/figs/example1-class-diagram-p1.12.png | Bin 20119 -> 0 bytes .../doc/figs/example2-class-diagram-mdt.png | Bin 27481 -> 0 bytes .../doc/figs/example2-class-diagram-p1.12.png | Bin 33830 -> 0 bytes .../plugin.properties | 12 - .../plugin.xml | 55 -- .../papyrus/conversion/di2todi/Activator.java | 61 -- .../di2todi/blackboxes/UtilitiesLibrary.java | 236 -------- .../di2todi/popupactions/Di2toDiAction.java | 253 -------- .../di2todi/popupactions/PapyrusNamespace.java | 80 --- .../org.eclipse.papyrus.conversion.di2todi/toc.xml | 10 - .../tocdev.xml | 7 - 40 files changed, 4156 deletions(-) delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/.classpath delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/.project delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/META-INF/MANIFEST.MF delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassAndProfileDiagEdgeVisualIDs.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassAndProfileDiagEdges.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassDiagNodes.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassDiagVisualIDs.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/CompositeDiagEdges.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/CompositeDiagNodes.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/CompositeDiagVisualIDs.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/DiTransformations.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/Diagram.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ElementType.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/GeneralMappingsandHelpers.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/NotationQueries.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ProfileDiagNodes.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ProfileDiagVisualIDs.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/StateDiagEdges.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/StateDiagNodes.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/StateDiagVisualIDs.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/Transfo.qvto delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/build.properties delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/doc/TutorialConversion.html delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/conversion-example-di2action.png delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/conversion-example-project.png delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/conversion-example-result.png delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example-composite-diag-mdt.png delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example-composite-diag-p1.12.png delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example1-class-diagram-mdt.png delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example1-class-diagram-p1.12.png delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example2-class-diagram-mdt.png delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example2-class-diagram-p1.12.png delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/plugin.properties delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/plugin.xml delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/Activator.java delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/blackboxes/UtilitiesLibrary.java delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/popupactions/Di2toDiAction.java delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/popupactions/PapyrusNamespace.java delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/toc.xml delete mode 100644 deprecated/org.eclipse.papyrus.conversion.di2todi/tocdev.xml diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/.classpath b/deprecated/org.eclipse.papyrus.conversion.di2todi/.classpath deleted file mode 100644 index 2d1a4302f04..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/.project b/deprecated/org.eclipse.papyrus.conversion.di2todi/.project deleted file mode 100644 index afabadc6203..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/.project +++ /dev/null @@ -1,34 +0,0 @@ - - - org.eclipse.papyrus.conversion.di2todi - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - org.eclipse.pde.api.tools.apiAnalysisBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - org.eclipse.pde.api.tools.apiAnalysisNature - - diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/META-INF/MANIFEST.MF b/deprecated/org.eclipse.papyrus.conversion.di2todi/META-INF/MANIFEST.MF deleted file mode 100644 index bad2bb38a43..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/META-INF/MANIFEST.MF +++ /dev/null @@ -1,28 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.papyrus.conversion.di2todi;singleton:=true -Bundle-Version: 0.8.0.qualifier -Bundle-Activator: org.eclipse.papyrus.conversion.di2todi.Activator -Bundle-Vendor: %pluginProvider -Require-Bundle: org.eclipse.m2m.qvt.oml;bundle-version="3.0.0", - org.eclipse.ui, - org.eclipse.core.runtime, - org.eclipse.core.resources, - org.eclipse.m2m.qvt.oml.runtime;bundle-version="2.1.0", - org.eclipse.uml2.uml;bundle-version="3.1.0", - org.eclipse.gmf.runtime.notation;bundle-version="1.4.0", - org.eclipse.m2m.qvt.oml.emf.util;bundle-version="2.0.100", - org.eclipse.papyrus.conversion.di2, - org.eclipse.papyrus.uml.diagram.clazz;bundle-version="0.10.1" -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Bundle-ActivationPolicy: lazy -Import-Package: junit.framework, - org.apache.commons.io, - org.eclipse.draw2d.geometry, - org.eclipse.gmf.runtime.diagram.ui.view.factories, - org.eclipse.m2m.internal.qvt.oml.common, - org.eclipse.m2m.internal.qvt.oml.common.io, - org.eclipse.m2m.internal.qvt.oml.project.builder, - org.eclipse.m2m.internal.qvt.oml.project.nature, - org.eclipse.m2m.qvt.oml.debug.core.launch diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassAndProfileDiagEdgeVisualIDs.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassAndProfileDiagEdgeVisualIDs.qvto deleted file mode 100644 index f0837e19292..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassAndProfileDiagEdgeVisualIDs.qvto +++ /dev/null @@ -1,39 +0,0 @@ - ---Author Manel Fredj-CEA LIST - -library VisualIDs; - ---for an association -property VisualId_Edge_Association : String = "4001"; -property VisualId_Edge_Association_DecoNode1 : String = "6001"; -property VisualId_Edge_Association_DecoNode2 : String = "6002"; -property VisualId_Edge_Association_DecoNode3 : String = "6003"; -property VisualId_Edge_Association_DecoNode4 : String = "6005"; -property VisualId_Edge_Association_DecoNode5 : String = "6033"; -property VisualId_Edge_Association_DecoNode6 : String = "6034"; - ---for a generalization within class diagram -property VisualId_Edge_Generalization : String = "4002"; -property VisualId_Edge_Generalization_DecoNode : String = "6007"; - ---for a dependency -property VisualId_Edge_Dependency : String = "4008"; -property VisualId_Edge_Dependency_DecoNode1 : String = "6026"; -property VisualId_Edge_Dependency_DecoNode2 : String = "6027"; - ---for a realization -property VisualId_Edge_Realization : String = "4005"; - -property VisualId_Edge_Realization_DecoNode1 : String = "6012"; -property VisualId_Edge_Realization_DecoNode2 : String = "6013"; - ---for a link (different for profile and class!) -property VisualId_CEdge_Link : String = "4013"; -property VisualId_PEdge_Link : String = "1022"; - ---for a package import -property VisualId_Edge_PackageImport : String = "1065"; -property VisualId_Edge_PackageImport_DecoNode : String = "6022"; - ---for an extension -property VisualId_Edge_Extension : String = "1013"; \ No newline at end of file diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassAndProfileDiagEdges.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassAndProfileDiagEdges.qvto deleted file mode 100644 index 046a85c23ba..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassAndProfileDiagEdges.qvto +++ /dev/null @@ -1,280 +0,0 @@ ---Author Manel Fredj-CEA LIST - -library HelpersEdge; -import GeneralMappingsandHelpers; -import NotationQueries; -import ClassAndProfileDiagEdgeVisualIDs; - -modeltype di2 uses 'http://www.papyrusuml.org/di2'; -modeltype notation uses 'http://www.eclipse.org/gmf/runtime/1.0.2/notation'; -modeltype uml uses 'http://www.eclipse.org/uml2/2.1.0/UML'; - ---class and profile have identical visual IDs for relationships ---Since the profile diagram has been developed starting with a class diagram. This ---is not the case for other diagram types -mapping di2::GraphEdge::classAndProfileDiagEdge2Edge() : notation::Connector inherits di2::GraphEdge::edge2Connector -{ - --setting the type and children - if (self.getElement() != null) then { - - if (self.getElement().isGeneralization()) then { - type := VisualId_Edge_Generalization; - --adding children - children := setChildrenForGeneralization(); - } endif; - if (self.getElement().oclIsTypeOf(uml::Extension)) then { - type := VisualId_Edge_Extension; - --adding children - // children := setChildrenForExtension(); - } else { - // extension is also an association, use "else" (else if is unfortunatley not supported in QVTO) - if (self.getElement().isAssociation()) then { - type := VisualId_Edge_Association; - children := setChildrenForAssociation(); - } endif; - } endif; - if (self.getElement().oclIsTypeOf(uml::PackageImport)) then { - type := VisualId_Edge_PackageImport; - children := setChildrenForPackageImport(); - } endif; - if (self.getElement().isDependency()) then { - type := VisualId_Edge_Dependency; - --adding children - children := setChildrenForDependency(); - } endif; - if (self.getElement().isRealization()) then { - type := VisualId_Edge_Realization; - --adding children - children := setChildrenForRealization(); - } endif; - } - else { - --it is a link - var diagType : String = self.getDiagramtype (); - if (diagType = ClassDiagram_P2) then { - type := VisualId_CEdge_Link; - } - else { - if (diagType = ProfileDiagram_P2) then { - type := VisualId_PEdge_Link; - } endif; - } endif; - element := null; - } endif; - - --setting the source and target Anchors - var anchors : OrderedSet (di2::GraphConnector) := self.anchor; - anchors->forEach (gc) { - --log("the anchor is "+ gc.graphElement.repr()); - gc.graphElement; - }; - source := anchors->first().graphElement.oclAsType(di2::GraphNode).late resolveone(notation::Shape); - target := anchors->last().graphElement.oclAsType(di2::GraphNode).late resolveone(notation::Shape); - --adding style - styles := setStyleForEdge(); - - --adding element: already done in View - - --adding the bend points - bendpoints := setBendpointsForEdge(); - - --adding the source and target Anchor - sourceAnchor := setSourceAnchor(); - targetAnchor := setTargetAnchor(); -} - - ---Helpers related to an Edge --------------------------------- - - ---generic helper for an edge with two children ---takes as input the visual ids of the the two children - -helper setChildrenForEdge2Children(in VisualId1: String, in VisualId2: String): OrderedSet(notation::Node) -{ - var child1 := object notation::DecorationNode { - --the id is set automatically - type := VisualId1; - layoutConstraint := object notation::Location { - y := 40; - }; - }; - - --second child - var child2 :=object notation::DecorationNode { - --the id is set automatically - type := VisualId2; - layoutConstraint := object notation::Location { - y := 60; - }; - }; - - return OrderedSet {child1,child2}; -} - -helper setChildrenForRealization(): OrderedSet(notation::Node) -{ - return setChildrenForEdge2Children(VisualId_Edge_Realization_DecoNode1, VisualId_Edge_Realization_DecoNode2); - -} - -helper setChildrenForDependency(): OrderedSet(notation::Node) -{ - -- - -- - -- - -- - -- - -- - return setChildrenForEdge2Children(VisualId_Edge_Dependency_DecoNode1, VisualId_Edge_Dependency_DecoNode2); - -} - -helper setChildrenForGeneralization(): OrderedSet(notation::Node) -{ - -- - -- - -- - - var child1 := object notation::DecorationNode { - --the id is set automatically - --type := VisualId_DecoNodeGeneralization; - type := VisualId_Edge_Generalization_DecoNode; - layoutConstraint := object notation::Location { - y := 40; - }; - }; - - return OrderedSet {child1}; -} - - -helper setChildrenForAssociation(): OrderedSet(notation::Node) -{ - ---------------------------------------------------------------------- - --under an Edge "association" - ----------------------------------------------------------------------- - --In the case that we have an association we will have: - --1 edge with a xmi:type:="notation:Connector", a geneerated Id, type= "4001", a target and a source that includes: - -- 6 "children" typed with decoration nodes - -- 1 "styles - -- 1 element - -- 1 bendpoints - -- 1 sourceAnchor - -- 1 targetAnchor - ----------------------------------------------------------------------- - - --first child - var child1 := object notation::DecorationNode { - --the id is set automatically - type := VisualId_Edge_Association_DecoNode1; - layoutConstraint := object notation::Location { - y := -20; - }; - }; - - --second child - var child2 :=object notation::DecorationNode { - --association label - type := VisualId_Edge_Association_DecoNode2; - layoutConstraint := object notation::Location { - y := 20; - }; - // make label of association itself (not its endpoints) non visible by default - visible := false; - }; - - --third child - var child3 := object notation::DecorationNode { - --label first association end - type := VisualId_Edge_Association_DecoNode3; - layoutConstraint := object notation::Location { - y := -20; - }; - eAnnotations += noTypeEAnnotation(); - }; - - --fourth child - var child4 := object notation::DecorationNode { - --label 2nd association end - type := VisualId_Edge_Association_DecoNode4; - layoutConstraint := object notation::Location { - y := 20; - }; - eAnnotations += noTypeEAnnotation(); - }; - - --fifth child - var child5 := object notation::DecorationNode { - --multiplicity first association end - type := VisualId_Edge_Association_DecoNode5; - visible := false; - --layoutConstraint := object notation::Location{ - --y := 20; - --x := 20; - --}; - }; - - --sixth child - var child6 := object notation::DecorationNode { - --the id is set automatically - --multiplicity 2nd association end - type := VisualId_Edge_Association_DecoNode6; - visible := false; - --layoutConstraint := object notation::Location { - --y := -20; - --x := -20; - --}; - }; - - --add the set of children to the node - return OrderedSet { - child1, child2, child3, child4, child5, child6 - }; -} - - -helper setStyleForEdge() : OrderedSet(notation::Style) -{ - -- - var style := object notation::FontStyle { - --the id is set automatically - --fontName="Sans Serif"; - }; - - return OrderedSet{style}; -} - -helper setSourceAnchor() : notation::Anchor -{ - return object notation::IdentityAnchor { }; -} - - -helper setTargetAnchor():notation::Anchor -{ - return object notation::IdentityAnchor { }; -} - - -helper setBendpointsForEdge():notation::RelativeBendpoints -{ - -- - // var pts : notation::RelativeBendpointList; - // var bendpoints:=object notation::RelativeBendpoints { }; - var bendpoints := createBendpoints().oclAsType (notation::RelativeBendpoints); - - return bendpoints; -} - -helper setChildrenForPackageImport(): OrderedSet(notation::Node) -{ - var child1 := object notation::DecorationNode { - --the id is set automatically - --type := VisualId_DecoNodeGeneralization; - type := VisualId_Edge_PackageImport_DecoNode; - }; - - return OrderedSet {child1}; -} \ No newline at end of file diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassDiagNodes.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassDiagNodes.qvto deleted file mode 100644 index 8c7168fa8fd..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassDiagNodes.qvto +++ /dev/null @@ -1,658 +0,0 @@ ---Author Manel Fredj-CEA LIST -library HelpersClassDiagram; - - -import ClassDiagVisualIDs; -import NotationQueries; -import GeneralMappingsandHelpers; - - -modeltype di2 uses 'http://www.papyrusuml.org/di2'; -modeltype notation uses 'http://www.eclipse.org/gmf/runtime/1.0.2/notation'; -modeltype ecore uses 'http://www.eclipse.org/emf/2002/Ecore'; -modeltype uml uses 'http://www.eclipse.org/uml2/2.1.0/UML'; - - -mapping di2::GraphNode::classDiagNode2Shape() : notation::Shape inherits di2::GraphNode::node2Shape -{ - eAnnotations := setEAnnotations (); - - if (self.getElement().oclIsTypeOf(uml::Class)) then { - type := VisualId_Class; - children := setChildrenForClass(self); - styles := setStylesForClass(); - } endif; - if (self.getElement().oclIsTypeOf(uml::Comment)) then { - type := VisualId_Comment; - children := setChildrenForComment(); - } endif; - if (self.getElement().oclIsTypeOf(uml::Profile)) then { - type := VisualId_Profile; - children := setChildrenForProfile(self); - } endif; - if (self.getElement().oclIsTypeOf(uml::Stereotype)) then { - type := VisualId_Stereotype; - children := setChildrenForStereotype(); - } endif; - if (self.getElement().oclIsTypeOf(uml::Package)) then { - type := VisualId_Package; - children := setChildrenForPackage(self); - } endif; - if (self.getElement().oclIsTypeOf(uml::Enumeration)) then { - type := VisualId_Enum; - children := setChildrenForEnum(self); - } endif; - if (self.getElement().oclIsTypeOf(uml::Interface)) then { - type := VisualId_Interface; - children := setChildrenForInterface(self); - } endif; - if (self.getElement().oclIsTypeOf(uml::PrimitiveType)) then { - type := VisualId_PrimitiveType; - children := setChildrenForPrimitiveType(self); - } endif; - if (self.getElement().oclIsTypeOf(uml::DataType)) then { - type := VisualId_DataType; - children := setChildrenForDataType(self); - } endif; - if (self.getElement().oclIsTypeOf(uml::Model)) then { - type := VisualId_Package; - } endif; - if (self.getElement().oclIsTypeOf(uml::Component)) then { - type := VisualId_Component; - children := setChildrenForComponent(self); - } endif; - if (self.getElement().oclIsTypeOf(uml::RedefinableTemplateSignature)) then { - type := VisualId_RedefinableTemplateSig; - children := setChildrenForRedefinableTemplateSignature(self); - } endif; -} - - ---for a class ---first argument is related to the contained operations which are integrated in the third child, i.e. the ---basic compartment typed 7018 -helper setChildrenForClass (in node:di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_Class_Label; - --the id is set automatically - }; - - -- second child - var child2 := object notation::BasicCompartment { - type:=VisualId_Class_Attributes; - --the id is set automatically - --set the properties - children := setAttributesForClass(node); - var style1 := object notation::SortingStyle { - --the id is set automatically - }; - var style2 := object notation::FilteringStyle { - --the id is set automatically - }; - styles := OrderedSet { - style1, style2 - }; - layoutConstraint:=object notation::Bounds {}; - }; - - -- third child includes operations - var child3 := object notation::BasicCompartment { - type := VisualId_Class_Operations; - --the id is set automatically - --set the operations - children := setOperationsForClass(node); - --set the styles - var style1 := object notation::SortingStyle { - --the id is set automatically - }; - var style2 := object notation::FilteringStyle { - --the id is set automatically - }; - styles := OrderedSet { - style1, style2 - }; - layoutConstraint := object notation::Bounds {}; - }; - - -- fourth child - var child4 := object notation::BasicCompartment { - type := VisualId_Class_UseCase; - --the id is set automatically - var style1 := object notation::SortingStyle { - --the id is set automatically - }; - var style2 := object notation::FilteringStyle { - --the id is set automatically - }; - styles := OrderedSet { - style1, - style2 - }; - layoutConstraint := object notation::Bounds {}; - }; - - return OrderedSet { - child1, child2, child3, child4 - }; -} - - - ---for a ForRedefinableTemplateSignature - -helper setChildrenForRedefinableTemplateSignature (in node:di2::GraphNode) : OrderedSet(notation::Node) -{ - var containedCTP:= object notation::DecorationNode { - type:=VisualId_ContainerofCTP; - - children:= setClassifierTemplateParameters(node); - - var style1 := object notation::SortingStyle { - }; - var style2 := object notation::FilteringStyle { - }; - styles := OrderedSet { - style1, style2 - }; - layoutConstraint:=object notation::Bounds {}; - - }; - var containedCTPs : OrderedSet(notation::Node); - containedCTPs += containedCTP; - return containedCTPs; -} - -helper setClassifierTemplateParameters(in node:di2::GraphNode):OrderedSet (notation::Node){ - var CTPShapes : OrderedSet(notation::Shape); - var containedCTPs : OrderedSet(ecore::EObject) := node.getClassifierTemplateParameter(); - containedCTPs->forEach (CTP) { - -- - -- - -- - -- - - var CTPShape := object notation::Shape { - type := VisualId_ClassifierTemplateParameter; - element := CTP; - layoutConstraint := object notation::Location {}; - }; - - CTPShapes += CTPShape; - }; - - return CTPShapes; -} - ---for a primitive type -helper setChildrenForPrimitiveType (in node:di2::GraphNode) : OrderedSet(notation::Node) -{ - -- - -- - -- - -- - - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_PrimitiveTypeChild; - --the id is set automatically - }; - - --add the set of children to the node - return OrderedSet { - child1 - }; -} - ---for a data type -helper setChildrenForDataType (in node:di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := "5035"; - --the id is set automatically - }; - - -- second child - var child2 := object notation::BasicCompartment { - type := "7020"; - --the id is set automatically - --set the operations - children := setAttributesForClass(node); - var style1 := object notation::SortingStyle { - --the id is set automatically - }; - var style2 := object notation::FilteringStyle { - --the id is set automatically - }; - styles := OrderedSet { - style1, style2 - }; - layoutConstraint:=object notation::Bounds {}; - }; - - -- third child includes operations - var child3 := object notation::BasicCompartment { - type := "7021"; - --the id is set automatically - --set the operations - children := setOperationsForClass(node); - --set the styles - var style1 := object notation::SortingStyle { - --the id is set automatically - }; - var style2 := object notation::FilteringStyle { - --the id is set automatically - }; - styles := OrderedSet { - style1, style2 - }; - layoutConstraint := object notation::Bounds {}; - }; - --add the set of children to the node - return OrderedSet { - child1, child2, child3 - }; -} - ---for an interface -helper setChildrenForInterface (in node:di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := "5011"; - }; - - -- second child - var child2 := object notation::BasicCompartment { - type := "7006"; - --the id is set automatically - --set the operations - children := setAttributesForClass(node); - var style1 := object notation::SortingStyle { - --the id is set automatically - }; - var style2 := object notation::FilteringStyle { - --the id is set automatically - }; - styles := OrderedSet { - style1, style2 - }; - layoutConstraint:=object notation::Bounds {}; - }; - - -- third child includes operations - var child3 := object notation::BasicCompartment { - type := "7007"; - --the id is set automatically - --set the operations - children := setOperationsForClass(node); - --set the styles - var style1 := object notation::SortingStyle { - --the id is set automatically - }; - var style2 := object notation::FilteringStyle { - --the id is set automatically - }; - styles := OrderedSet { - style1, style2 - }; - layoutConstraint := object notation::Bounds {}; - }; - - -- third child includes operations - var child4 := object notation::BasicCompartment { - type := "7008"; - --the id is set automatically - --set the operations - --children := setOperationsForClass(node); - --set the styles - var style1 := object notation::SortingStyle { - --the id is set automatically - }; - var style2 := object notation::FilteringStyle { - --the id is set automatically - }; - styles := OrderedSet { - style1, style2 - }; - layoutConstraint := object notation::Bounds {}; - }; - - --add the set of children to the node - return OrderedSet { - child1, child2, child3, child4 - }; -} - ---for an enumeration -helper setChildrenForEnum (in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_Enum_Label; - --the id is set automatically - }; - - -- second child - var child2 := object notation::BasicCompartment { - type := VisualId_Enum_Literals; - --set the literals - children := getLiterals(node); - var style1 := object notation::SortingStyle { }; - var style2 := object notation::FilteringStyle { }; - styles := OrderedSet { - style1, style2 - }; - layoutConstraint := object notation::Bounds {}; - --the id is set automatically - }; - - --add the set of children to the node - return OrderedSet { - child1, child2 - }; -} - - -helper setStylesForClass() : OrderedSet(notation::Style) -{ - var style:=object notation::HintedDiagramLinkStyle { - --the id is set automatically - }; - - return OrderedSet{style}; -} - - ---reusable Helpers -helper setOperations(in node:di2::GraphNode,in VisualId:String): OrderedSet(notation::Node) -{ - var operationsShape : OrderedSet(notation::Node); - var containedOp : OrderedSet(ecore::EObject) := node.getOperations(); - containedOp->forEach (operation) { - var operationShape := object notation::Shape { - --an operation is typed 3013 - type := VisualId; - --fontHeight="8"; - --lineColor="0"; - element := operation; - layoutConstraint := object notation::Location{}; - }; - - operationsShape += operationShape; - }; - - return operationsShape; -} - -helper setAttributes(in node : di2::GraphNode, in VisualId:String) : OrderedSet(notation::Node) -{ - var attributesShape : OrderedSet(notation::Node); - var attributes : OrderedSet(ecore::EObject) := node.getProperties(); - attributes->forEach (attribute) { - var attributeShape := object notation::Shape { - -- an attribute is type 3012 - type := VisualId; - --fontName="Sans Serif"; - --lineColor="0"; - element := attribute; - layoutConstraint := object notation::Location{}; - }; - attributesShape += attributeShape; - }; - - return attributesShape; -} - ---in containedOp:OrderedSet(ecore::EObject) -helper setOperationsForClass(in node:di2::GraphNode): OrderedSet(notation::Node) -{ - return setOperations(node,VisualId_Class_Operation); -} - ---in containedAttr:OrderedSet (ecore::EObject) -helper setAttributesForClass(in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - return setAttributes(node,VisualId_Class_Attribute); -} - ---for Enumeration ---in containedAttr:OrderedSet (ecore::EObject) -helper getLiterals(in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - var enumLiteralsShape : OrderedSet(notation::Node); - var enumLiterals : OrderedSet(ecore::EObject) := node.getEnumLiterals(); - enumLiterals->forEach (enumLiteral) { - var enumLiteralShape := object notation::Shape { - -- an attribute is typed 3017 - type := VisualId_EnumLiteral; - --fontName="Sans Serif"; - --lineColor="0"; - element := enumLiteral; - layoutConstraint := object notation::Location{}; - }; - enumLiteralsShape += enumLiteralShape; - }; - - return enumLiteralsShape; -} - ---for a component -helper setChildrenForComponent (in node:di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_Component_child1; - --the id is set automatically - }; - - -- second child - var child2 := object notation::BasicCompartment { - type := VisualId_Component_child2; - --the id is set automatically - --set the properties - children := setAttributesForComponent(node); - var style1 := object notation::SortingStyle { - --the id is set automatically - }; - var style2 := object notation::FilteringStyle { - --the id is set automatically - }; - styles := OrderedSet { - style1, style2 - }; - layoutConstraint := object notation::Bounds {}; - }; - - -- third child - var child3 := object notation::BasicCompartment { - type := VisualId_Component_child3; - --the id is set automatically - --set the operations - children := setOperationsForComponent(node); - var style1 := object notation::SortingStyle { - --the id is set automatically - }; - var style2 := object notation::FilteringStyle { - --the id is set automatically - }; - styles := OrderedSet { - style1, style2 - }; - layoutConstraint := object notation::Bounds {}; - }; - - -- fourth child - var child4 := object notation::BasicCompartment { - type := VisualId_Component_child4; - --the id is set automatically - var style1 := object notation::SortingStyle { - --the id is set automatically - }; - var style2 := object notation::FilteringStyle { - --the id is set automatically - }; - styles := OrderedSet { - style1, style2 - }; - layoutConstraint := object notation::Bounds {}; - }; - - return OrderedSet { - child1, child2,child3,child4 - }; -} - ---in containedOp:OrderedSet(ecore::EObject) -helper setOperationsForComponent(in node:di2::GraphNode): OrderedSet(notation::Node) -{ - return setOperations(node,VisualId_Component_Operation); -} - ---in containedAttr:OrderedSet (ecore::EObject) -helper setAttributesForComponent(in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - return setAttributes(node, VisualId_Component_Attribute); -} - - ---for a stereotype -helper setChildrenForStereotype() : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_Stereotype_child1; - --the id is set automatically - }; - - -- second child - var child2 := object notation::BasicCompartment { - type := VisualId_Stereotype_child2; - --the id is set automatically - var style1 := object notation::SortingStyle { - --the id is set automatically - }; - var style2 := object notation::FilteringStyle { - --the id is set automatically - }; - styles := OrderedSet { - style1, style2 - }; - layoutConstraint := object notation::Bounds {}; - - }; - - -- third child - var child3 := object notation::BasicCompartment { - type := VisualId_Stereotype_child3; - --the id is set automatically - var style1 := object notation::SortingStyle { - --the id is set automatically - }; - var style2 := object notation::FilteringStyle { - --the id is set automatically - }; - styles := OrderedSet { - style1, style2 - }; - layoutConstraint := object notation::Bounds {}; - }; - - -- fourth child - var child4 := object notation::BasicCompartment { - type := VisualId_Stereotype_child4; - --the id is set automatically - var style1 := object notation::SortingStyle { - --the id is set automatically - }; - var style2 := object notation::FilteringStyle { - --the id is set automatically - }; - styles := OrderedSet { - style1, style2 - }; - layoutConstraint := object notation::Bounds {}; - }; - - return OrderedSet { - child1, child2, child3, child4 - }; -} - - ---for a profile in a class diagram -helper setChildrenForProfile (in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_Profile_child1; - --the id is set automatically - }; - - -- second child - var child2 := object notation::DecorationNode { - type := VisualId_Profile_child2; - children := addStereotypestoProfile(node); - layoutConstraint := object notation::Bounds {}; - --the id is set automatically - }; - - --add the set of children to the node - return OrderedSet {child1, child2}; -} - ---stereotype -helper addStereotypestoProfile (in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - - var SetofStereotypes : OrderedSet(notation::Node); - node.contained->forEach (elem|elem.oclIsTypeOf(di2::GraphNode)) { - if (elem.oclAsType(di2::GraphNode).getElement().oclIsTypeOf(uml::Stereotype))then{ - --create a new stereotype - var stereo:notation::Shape:=elem.oclAsType(di2::GraphNode).map classDiagNode2Shape(); - SetofStereotypes += stereo; - } endif; - }; - - return SetofStereotypes; -} - ---for a package -helper setChildrenForPackage (in node:di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_Package_Label; - --the id is set automatically - }; - - -- second child - var child2 := object notation::DecorationNode { - type := VisualId_Package_Label2; - var containedElements : OrderedSet(di2::GraphNode) := node.getSubElementsOfPackage(); - containedElements->forEach (containedElement) { - var shape : notation::Shape ::= containedElement.map classDiagNode2Shape(); - children += shape; - }; - }; - - return OrderedSet { - child1, child2 - }; -} - - ---Helpers related to a Comment --------------------------------- - -helper setChildrenForComment () : OrderedSet(notation::Node) -{ - -- - var child1 := object notation::DecorationNode { - type:=VisualId_Comment_Child; - - }; - return OrderedSet {child1}; -} \ No newline at end of file diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassDiagVisualIDs.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassDiagVisualIDs.qvto deleted file mode 100644 index 9b5def30876..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ClassDiagVisualIDs.qvto +++ /dev/null @@ -1,66 +0,0 @@ - ---Author Manel Fredj-CEA LIST - -library VisualIDs; - --- for an interface -property VisualId_Interface : String = "2004"; - --- for a package -property VisualId_Package : String = "2005"; - ---for a profile -property VisualId_Profile : String = "2007"; -property VisualId_Profile_child1 : String = "5026"; -property VisualId_Profile_child2 : String = "7016"; - ---for a stereotype -property VisualId_Stereotype : String = "3010"; -property VisualId_Stereotype_child1 : String = "5014"; -property VisualId_Stereotype_child2 : String = "7011"; -property VisualId_Stereotype_child3 : String = "7012"; -property VisualId_Stereotype_child4 : String = "7013"; - --- for a class -property VisualId_Class : String = "2008"; - ---for a comment -property VisualId_Comment : String = "2012"; -property VisualId_Comment_Child : String = "5038"; --- for a data type -property VisualId_DataType : String = "2010"; - --- for a primitive type -property VisualId_PrimitiveType : String = "2009"; -property VisualId_PrimitiveTypeChild : String = "5032"; - --- for an enumeration -property VisualId_Enum : String = "2006"; -property VisualId_EnumLiteral : String = "3017"; - --- for a redefinable Template signature -property VisualId_RedefinableTemplateSig : String = "3015"; -property VisualId_ClassifierTemplateParameter : String = "3031"; -property VisualId_ContainerofCTP : String = "7014"; - ---for a component -property VisualId_Component : String ="2002"; -property VisualId_Component_child1 : String ="5005"; -property VisualId_Component_child2 : String ="7002"; -property VisualId_Component_child3 : String ="7003"; -property VisualId_Component_child4 : String ="7004"; -property VisualId_Component_Attribute : String = "3002"; -property VisualId_Component_Operation : String = "3003"; - ---for a class -property VisualId_Class_Label : String = "5029"; -property VisualId_Class_Attributes : String = "7017"; -property VisualId_Class_Operations : String = "7018"; -property VisualId_Class_UseCase : String = "7019"; - -property VisualId_Package_Label : String = "5020"; -property VisualId_Package_Label2 : String = "7009"; -property VisualId_Enum_Label : String = "5023"; -property VisualId_Enum_Literals : String = "7015"; -property VisualId_Class_Operation : String = "3013"; -property VisualId_Class_Attribute : String = "3012"; diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/CompositeDiagEdges.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/CompositeDiagEdges.qvto deleted file mode 100644 index 1e20a5438df..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/CompositeDiagEdges.qvto +++ /dev/null @@ -1,162 +0,0 @@ ---Author Manel Fredj-CEA LIST - -library HelpersEdge; -import GeneralMappingsandHelpers; -import CompositeDiagVisualIDs; - -modeltype di2 uses 'http://www.papyrusuml.org/di2'; -modeltype notation uses 'http://www.eclipse.org/gmf/runtime/1.0.2/notation'; -modeltype uml uses 'http://www.eclipse.org/uml2/2.1.0/UML'; - -mapping di2::GraphEdge::compositeDiagEdge2Edge() : notation::Connector inherits di2::GraphEdge::edge2Connector -{ - ----------------------------------------------------------------------- - --under an Edge "association" - ----------------------------------------------------------------------- - --In the case that we have an association we will have: - --1 edge with a xmi:type:="notation:Connector", a geneerated Id, type= "4001", a target and a source that includes: - -- 6 "children" typed with decoration nodes - -- 1 "styles - -- 1 element - -- 1 bendpoints - --1 sourceAnchor - --1targetAnchor - ----------------------------------------------------------------------- - - --setting the type and children - if (self.getElement() != null) then { - - if (self.getElement().isGeneralization()) then { - type := VisualId_Edge_GeneralizationComp; - --adding children - children := setChildrenForGeneralization(); - } endif; - if (self.getElement().oclIsTypeOf(uml::Connector)) then { - type := VisualId_Edge_Link; - --adding children - children:=setChildrenForConnector(); - } endif; - } endif; - - --setting the source and target Anchors - var anchors : OrderedSet (di2::GraphConnector) := self.anchor; - anchors->forEach (gc) { - --log("the anchor is "+ gc.graphElement.repr()); - gc.graphElement; - }; - source := anchors->first().graphElement.oclAsType(di2::GraphNode).late resolveone(notation::Shape); - target := anchors->last().graphElement.oclAsType(di2::GraphNode).late resolveone(notation::Shape); - --adding style - styles := setStyleForEdge(); - - --adding element: already done in View - - --adding the bend points - bendpoints := setBendpointsForEdge(); - - --adding the source and target Anchor - sourceAnchor := setSourceAnchor(); - targetAnchor := setTargetAnchor(); -} - - ---Helpers related to an Edge --------------------------------- - - ---generic helper for an edge with two children ---takes as input the visual ids of the the two children - -helper setChildrenForEdge2Children(in VisualId1: String, in VisualId2: String): OrderedSet(notation::Node) -{ - var child1 := object notation::DecorationNode { - --the id is set automatically - type := VisualId1; - layoutConstraint := object notation::Location { - y := 40; - }; - }; - - --second child - var child2 :=object notation::DecorationNode { - --the id is set automatically - type := VisualId2; - layoutConstraint := object notation::Location { - y := 60; - }; - }; - - return OrderedSet {child1,child2}; -} - - -helper setChildrenForGeneralization(): OrderedSet(notation::Node) -{ - -- - -- - -- - - var child1 := object notation::DecorationNode { - --the id is set automatically - --type := VisualId_DecoNodeGeneralization; - type := VisualId_DecoNodeGeneralizationComp; - layoutConstraint := object notation::Location { - y := 40; - }; - }; - - return OrderedSet {child1}; -} - - - -helper setChildrenForConnector(): OrderedSet(notation::Node) -{ - -- - -- - -- - - var child1 := object notation::DecorationNode { - --the id is set automatically - type := VisualId_Edge_Connector_Child; - layoutConstraint := object notation::Location { - y := 60; - }; - }; - - return OrderedSet {child1}; -} - - -helper setStyleForEdge() : OrderedSet(notation::Style) -{ - -- - var style := object notation::FontStyle { - --the id is set automatically - --fontName="Sans Serif"; - }; - - return OrderedSet{style}; -} - -helper setSourceAnchor() : notation::Anchor -{ - return object notation::IdentityAnchor { }; -} - - -helper setTargetAnchor():notation::Anchor -{ - return object notation::IdentityAnchor { }; -} - - -helper setBendpointsForEdge():notation::RelativeBendpoints -{ - -- - // var pts : notation::RelativeBendpointList; - // var bendpoints:=object notation::RelativeBendpoints { }; - var bendpoints := createBendpoints().oclAsType (notation::RelativeBendpoints); - - return bendpoints; -} \ No newline at end of file diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/CompositeDiagNodes.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/CompositeDiagNodes.qvto deleted file mode 100644 index 4ba6c5d3fda..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/CompositeDiagNodes.qvto +++ /dev/null @@ -1,284 +0,0 @@ ---Author Manel Fredj-CEA LIST -library CompositeStructureDiagram; - -import Converter.Utils.ConverterLibs; -import CompositeDiagVisualIDs; -import GeneralMappingsandHelpers; - - -modeltype di2 uses 'http://www.papyrusuml.org/di2'; -modeltype notation uses 'http://www.eclipse.org/gmf/runtime/1.0.2/notation'; -modeltype ecore uses 'http://www.eclipse.org/emf/2002/Ecore'; -modeltype uml uses 'http://www.eclipse.org/uml2/2.1.0/UML'; - - -mapping di2::GraphNode::compositeDiagNode2Shape() : notation::Shape inherits di2::GraphNode::node2Shape -{ - if (self.getElement().oclIsTypeOf(uml::Class)) then { - type := VisualId_Class_Composite; - } endif; - - layoutConstraint := object notation::Bounds { - var size : notation::Size := - self.size.map dimension2Size(); - var relativeLocation: notation::Location :=null; - var location : notation::Location := - self.position.map point2Location(); - if (self.container.oclIsTypeOf(di2::GraphNode))then{ - relativeLocation:=self.container.position. map point2Location(); - x := location.x + relativeLocation.x; - y := location.y + relativeLocation.y; - }else{ - x := location.x; - y := location.y; - }endif; - width := size.width; - height := size.height; - }; - - --adding 3 eAnnotations as in class diagram - eAnnotations := setEAnnotations (); - - if (type = VisualId_Class_Composite) then { - --adding children - children := setChildrenForClassComposite(self); - --adding style - styles := setStylesForClass(); - } endif; -} - - ---------------------------------------------------------------------------- ---set children for composite class - -helper setChildrenForClassComposite(in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - var childrenOfCompositeClass: OrderedSet(notation::Node); - - -- - - -- - -- - -- - - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_Class_Composite_Label; - --the id is set automatically - }; - - -- second child - var child2 := object notation::BasicCompartment { - type := VisualId_Class_Composite_Compartment; - --set children as properties - children := setPropertiesForCompositeClass(node.contained); - layoutConstraint:=object notation::Bounds {}; - }; - - - childrenOfCompositeClass := OrderedSet{child1, child2}; - - - --convert ports of contained classes - var childport : notation::Node; - var itsParent : notation::Node; - node.contained->forEach (elem|elem.oclIsTypeOf(di2::GraphNode)) { - - if (elem.oclAsType(di2::GraphNode).getElement().oclIsTypeOf(uml::Port)) then { - childport := elem.oclAsType(di2::GraphNode).map compositeDiagPort2Shape(); - var temp: di2::DiagramElement:=elem.oclAsType(di2::GraphNode).getSemanticParent(); - itsParent:= temp.oclAsType(di2::GraphNode).resolveone (notation::Node); - --add the child to the semantic parent - itsParent.children+= childport; - } endif; - }; - - --convert edges in the composite - return childrenOfCompositeClass; -} - ---in contrained attributes: properties or nested classes -helper setPropertiesForCompositeClass(in contained:OrderedSet(di2::DiagramElement)) : OrderedSet(notation::Node) -{ - var setOfChildren:OrderedSet(notation::Node); - var child:notation::Node; - contained ->forEach (node|node.oclIsTypeOf(di2::GraphNode)) { - - if(node.oclAsType(di2::GraphNode).getElement().oclIsTypeOf(uml::Property)) then { - child := node.oclAsType(di2::GraphNode).map ComponentClass2Property(); - setOfChildren += child; - } endif; - if (node.oclAsType(di2::GraphNode).getElement().oclIsTypeOf(uml::Class)) then { - child := node.oclAsType(di2::GraphNode).map ComponentClass2Class(node.oclAsType(di2::GraphNode)); - setOfChildren += child; - } endif; - }; - - return setOfChildren; -} - - ------------------------------------------------------------------------------ --- case of properties -mapping di2::GraphNode::ComponentClass2Property() : notation::Shape { - - type := VisualId_Component_Property ; - --seteAnnotation - eAnnotations := setEAnnotations (); - --setchildren - children:=setChildrenForComponentProperty(); - - --set size and width and high - layoutConstraint := object notation::Bounds { - var size : notation::Size := self.size.map dimension2Size(); - var location : notation::Location := self.oclAsType(di2::GraphNode).position.map point2Location(); - x := location.x; - y := location.y; - width := size.width; - height := size.height; - }; - --set element - element := self.getElement().oclAsType(ecore::EObject); -} - -helper setChildrenForComponentProperty() : OrderedSet(notation::Node) -{ - -- - -- - -- - -- - - -- first child - var child1 := object notation::DecorationNode { - type:=VisualId_Component_Property_Label; - --the id is set automatically - }; - - -- second child - var child2 := object notation::BasicCompartment { - type:=VisualId_Component_Property_Compartiment; - layoutConstraint:=object notation::Bounds {}; - }; - - return OrderedSet {child1, child2}; -} - - ------------------------------------------------------------------------------ --- case of nested classes - -mapping di2::GraphNode::ComponentClass2Class(in node:di2::GraphNode) : notation::Shape { - - type := VisualId_Component_Class; - --seteAnnotation - eAnnotations := setEAnnotations (); - --setchildren - children:=setChildrenForComponentClass(node); - - --set size and width and high - layoutConstraint := object notation::Bounds { - var size : notation::Size := self.size.map dimension2Size(); - var location : notation::Location := self.oclAsType(di2::GraphNode).position.map point2Location(); - x := location.x; - y := location.y; - width := size.width; - height := size.height; - }; - - --set element - element := self.getElement().oclAsType(ecore::EObject); -} - -helper setChildrenForComponentClass(in node:di2::GraphNode) : OrderedSet(notation::Node) -{ - -- - -- - -- - -- - - -- first child - var child1 := object notation::DecorationNode { - type:=VisualId_Component_Class_Label; - --the id is set automatically - }; - - -- second child - var child2 := object notation::BasicCompartment { - type:=VisualId_Component_Class_Compartiment; - - --set children as properties in the case that the nested class contains properties - children:= setPropertiesForCompositeClass(node.contained); - layoutConstraint:=object notation::Bounds {}; - }; - - return OrderedSet{child1, child2}; -} - - --------------------------------- ---ports - -mapping di2::GraphNode::compositeDiagPort2Shape() : notation::Shape { - - type := VisualId_Port; - --seteAnnotation - eAnnotations := setEAnnotations (); - --setchildren - children:=setChildrenForPort(); - --set size and width and high - layoutConstraint := object notation::Bounds { - var size : notation::Size := self.size.map dimension2Size(); - var parentLocation: notation::Location :=null; - var location : notation::Location := self.oclAsType(di2::GraphNode).position.map point2Location(); - var itsparent: di2::DiagramElement:=self.oclAsType(di2::GraphNode).getSemanticParent(); - parentLocation:=itsparent.oclAsType(di2::GraphNode).position. map point2Location(); - x := location.x - parentLocation.x; - y := location.y - parentLocation.y; - width := size.width; - height := size.height; - }; - --set element - element := self.getElement().oclAsType(ecore::EObject); -} - - -helper setChildrenForPort() : OrderedSet(notation::Node) -{ - -- - -- - -- - -- - -- - -- - - -- first child - var child1 := object notation::DecorationNode { - type:=VisualId_Port_child1; - layoutConstraint:=object notation::Location { - x:=25; - y:=3; - }; - --the id is set automatically - }; - - -- second child - var child2 := object notation::BasicCompartment { - type:=VisualId_Port_child2; - layoutConstraint:=object notation::Location { - x:=25; - y:=-10; - }; - }; - - return OrderedSet{child1, child2}; -} - - -helper setStylesForClass() : OrderedSet(notation::Style) -{ - var style:=object notation::HintedDiagramLinkStyle { - --the id is set automatically - }; - - return OrderedSet{style}; -} \ No newline at end of file diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/CompositeDiagVisualIDs.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/CompositeDiagVisualIDs.qvto deleted file mode 100644 index 3383a9a68e5..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/CompositeDiagVisualIDs.qvto +++ /dev/null @@ -1,34 +0,0 @@ - ---Author Manel Fredj-CEA LIST - -library CompositeDiagVisualIDs; - ---for a generalization within composite diagram -property VisualId_Edge_GeneralizationComp : String = "4015"; -property VisualId_DecoNodeGeneralizationComp : String = "6024"; - ---for a link -property VisualId_Edge_Link : String = "4013"; - ---for a connector -property VisualId_Edge_Connector_Child : String = "6025"; - ---class in a composite diagram -property VisualId_Class_Composite : String = "2073"; -property VisualId_Class_Composite_Label : String = "5156"; -property VisualId_Class_Composite_Compartment : String = "7073"; - ---Property in composite diagram -property VisualId_Component_Property_Label : String = "5126"; -property VisualId_Component_Property_Compartiment : String = "7077"; -property VisualId_Component_Property : String = "3070"; - ---nested Class in composite diagram -property VisualId_Component_Class : String = "3085"; -property VisualId_Component_Class_Label : String = "5155"; -property VisualId_Component_Class_Compartiment : String = "7060"; - ---Port in composite diagram -property VisualId_Port : String = "3069"; -property VisualId_Port_child1 : String = "5125"; -property VisualId_Port_child2 : String = "6029"; diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/DiTransformations.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/DiTransformations.qvto deleted file mode 100644 index 950b5d2c6bd..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/DiTransformations.qvto +++ /dev/null @@ -1,103 +0,0 @@ - ---Author Manel Fredj-CEA LIST - - -modeltype di uses 'http://www.eclipse.org/papyrus/0.7.0/sashdi'; -modeltype di2 uses 'http://www.papyrusuml.org/di2'; -modeltype notation uses 'http://www.eclipse.org/gmf/runtime/1.0.2/notation'; -modeltype ecore uses 'http://www.eclipse.org/emf/2002/Ecore'; - - -transformation Transfo(in src : di2, out target1 : notation, out target2:di); - - -mapping di2::Diagram::diagram2SashWindowsMngr(): di::SashWindowsMngr -{ - --pageRefsclassandOp - var pageRefs: Set(di::PageRef) := setPageRef(); - --pageList - pageList := setPageList(pageRefs); - - --sashModel - sashModel := setSashModel(); -} - -mapping notation::Diagram::diagram2PageRef(): di::PageRef -{ - emfPageIdentifier := self.oclAsType(ecore::EObject); -} - - -------------------------------------------------------------------------------------------------------------------------- ----------------------------------------- Helpers for di --------------------------------------- -------------------------------------------------------------------------------------------------------------------------- - -helper setPageList(in pagerefs:Set(di::PageRef)): di::PageList -{ - var pageList := object di::PageList { - availablePage := pagerefs; - }; - - return pageList; -}; - - -helper setPageRef(): Set(di::PageRef) -{ - var setPages : Set(di::PageRef) := Set{}; - var page: di::PageRef; - target1.rootObjects()->forEach(diagram|diagram.oclIsTypeOf(notation::Diagram)) { - --avoid empty pages for unsupported diagrams (currently deployment diagram) - if (diagram.oclAsType(notation::Diagram).type != null) then { - page := diagram.oclAsType(notation::Diagram).map diagram2PageRef(); - setPages += page; - } endif; - }; - return setPages; -}; - - -helper setSashModel(): di::SashModel -{ - var sm := object di::SashModel{ - currentSelection:= object di::TabFolder{} ; - windows := setWindows(); - }; - return sm; -}; - -helper setWindows(): Set(di::Window) -{ - var setwindows : Set(di::Window); - setwindows += setWindow(); - return setwindows; -}; - -helper setWindow() : di::Window { - - var child := object di::TabFolder { - - target1.rootObjects()->forEach(diagram|diagram.oclIsTypeOf(notation::Diagram)) { - --avoid empty pages for unsupported diagrams (currently deployment diagram) - if (diagram.oclAsType(notation::Diagram).type != null) then { - var page : di::PageRef = object di::PageRef { - emfPageIdentifier:= diagram.oclAsType(ecore::EObject) - }; - children += page; - } endif; - }; - }; - - var window := object di::Window { - children := Set { child }; - }; - return window; -}; - ---helper SetChildren(): Set(di::PageRef){ - - --var setchildren:Set(di::PageRef):=Set{}; - --var page: di::PageRef; - - --return setchildren; ---}; diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/Diagram.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/Diagram.qvto deleted file mode 100644 index f88e9680aea..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/Diagram.qvto +++ /dev/null @@ -1,213 +0,0 @@ ---Author Manel Fredj-CEA LIST -library Diagram; - -import ClassDiagNodes; -import StateDiagNodes; -import ProfileDiagNodes; -import ClassAndProfileDiagEdges; -import CompositeDiagNodes; -import StateDiagEdges; -import CompositeDiagEdges; - ---import VisualIDs; -import NotationQueries; -import GeneralMappingsandHelpers; - -modeltype di uses 'http://www.eclipse.org/papyrus/0.7.0/sashdi'; -modeltype di2 uses 'http://www.papyrusuml.org/di2'; -modeltype notation uses 'http://www.eclipse.org/gmf/runtime/1.0.2/notation'; -modeltype ecore uses 'http://www.eclipse.org/emf/2002/Ecore'; -modeltype uml uses 'http://www.eclipse.org/uml2/2.1.0/UML'; - - -mapping di2::Diagram::diagram2diagram() : notation::Diagram inherits di2::GraphElement::element2View -{ - --the id is set automatically - --assign type - type := self.getDiagramtype(); - --assign name - name := self.name; - - --assign element - measurementUnit := notation::MeasurementUnit::Pixel; - - --transform contained nodes and edges - - if (type = ClassDiagram_P2) then { - children := setChildrenForClassDiagram(self.contained); - edges := setEdgesForClassAndProfileDiagram(self.contained); - } endif; - if (type = ProfileDiagram_P2) then { - children := setChildrenForProfileDiagram(self.contained); - edges := setEdgesForClassAndProfileDiagram(self.contained); - } endif; - if (type = CompositeStructure_P2) then { - children := setChildrenForCompositeDiagram(self.contained); - edges := setEdgesForCompositeDiagram(self.contained); - } endif; - if (type = StateMachineDiagram_P2) then { - children := setChildrenForStateDiagram(self.contained); - edges := setEdgesForStateDiagram(self.contained); - } endif; - - --Set Style of diagram - if (type != null) then { - styles := setStylesForDiagram(); - } endif; -} - - --------------------------------------------------------------- ---converting a composite diagram -helper setChildrenForCompositeDiagram(in contained:OrderedSet(di2::DiagramElement)) : OrderedSet(notation::Node) -{ - var setOfChildren:OrderedSet(notation::Node); - var child:notation::Node; - var itsParent: notation::Shape; - contained ->forEach (node|node.oclIsTypeOf(di2::GraphNode)) { - --case of containing a class - if (node.oclAsType(di2::GraphNode).getElement().oclIsTypeOf(uml::Class) ) then { - child := node.oclAsType(di2::GraphNode).map compositeDiagNode2Shape(); - setOfChildren += child; - } endif; - --case of containing a port : map the potr and attach it to the semantic parent - if (node.oclAsType(di2::GraphNode).getElement().oclIsTypeOf(uml::Port) ) then { - child := node.oclAsType(di2::GraphNode).map compositeDiagPort2Shape(); - var temp: di2::DiagramElement:=node.oclAsType(di2::GraphNode).getSemanticParent(); - itsParent:= temp.oclAsType(di2::GraphNode).resolveone (notation::Shape); - --add the child to the semantic parent - itsParent.children+= child; - } endif; - }; - - return setOfChildren; -} - ------------------------------------------------------------- ---converting a class diagram -helper setChildrenForClassDiagram (in contained:OrderedSet(di2::DiagramElement)) : OrderedSet(notation::Node) -{ - var setOfChildren:OrderedSet(notation::Node); - var child:notation::Node; - contained ->forEach (node|node.oclIsTypeOf(di2::GraphNode)) { - child := node.oclAsType(di2::GraphNode).map classDiagNode2Shape(); - setOfChildren += child; - }; - - return setOfChildren; -} - ------------------------------------------------------------- ---converting a profile diagram -helper setChildrenForProfileDiagram (in contained:OrderedSet(di2::DiagramElement)) : OrderedSet(notation::Node) -{ - var setOfChildren:OrderedSet(notation::Node); - var child:notation::Node; - contained ->forEach (node|node.oclIsTypeOf(di2::GraphNode)) { - child := node.oclAsType(di2::GraphNode).map profileDiagNode2Shape(); - setOfChildren += child; - }; - - return setOfChildren; -} - ---converting a state diagram -helper setChildrenForStateDiagram (in contained:OrderedSet(di2::DiagramElement)) : OrderedSet(notation::Node) -{ - var setOfChildren:OrderedSet(notation::Node); - var child:notation::Node; - contained ->forEach (node|node.oclIsTypeOf(di2::GraphNode)) { - child := node.oclAsType(di2::GraphNode).map stateDiagNode2Shape(); - setOfChildren += child; - }; - - return setOfChildren; -} - -helper setEdgesForClassAndProfileDiagram (in contained : OrderedSet(di2::DiagramElement)) : OrderedSet (notation::Edge) -{ - var setofEdges : OrderedSet(notation::Edge); - var edge : notation::Edge; - contained->forEach (node|node.oclIsTypeOf(di2::GraphEdge)) { - edge := node.oclAsType(di2::GraphEdge).map classAndProfileDiagEdge2Edge(); - setofEdges += edge; - }; - contained->forEach (composite|composite.oclIsTypeOf(di2::GraphNode)) { - composite.oclAsType(di2::GraphNode).contained->forEach (elem|elem.oclIsTypeOf(di2::GraphEdge)) { - edge := elem.oclAsType(di2::GraphEdge).map classAndProfileDiagEdge2Edge(); - setofEdges += edge; - }; - composite.oclAsType(di2::GraphNode).contained->forEach (prop|prop.oclIsTypeOf(di2::GraphNode)) { - prop.oclAsType(di2::GraphNode).contained->forEach (connect|connect.oclIsTypeOf(di2::GraphEdge)) { - edge := connect.oclAsType(di2::GraphEdge).map classAndProfileDiagEdge2Edge(); - setofEdges += edge; - }; - }; - }; - - return setofEdges; -} - -helper setEdgesForCompositeDiagram (in contained : OrderedSet(di2::DiagramElement)) : OrderedSet (notation::Edge) -{ - var setofEdges : OrderedSet(notation::Edge); - var edge : notation::Edge; - contained->forEach (node|node.oclIsTypeOf(di2::GraphEdge)) { - edge := node.oclAsType(di2::GraphEdge).map compositeDiagEdge2Edge(); - setofEdges += edge; - }; - contained->forEach (composite|composite.oclIsTypeOf(di2::GraphNode)) { - composite.oclAsType(di2::GraphNode).contained->forEach (elem|elem.oclIsTypeOf(di2::GraphEdge)) { - edge := elem.oclAsType(di2::GraphEdge).map compositeDiagEdge2Edge(); - setofEdges += edge; - }; - composite.oclAsType(di2::GraphNode).contained->forEach (prop|prop.oclIsTypeOf(di2::GraphNode)) { - prop.oclAsType(di2::GraphNode).contained->forEach (connect|connect.oclIsTypeOf(di2::GraphEdge)) { - edge := connect.oclAsType(di2::GraphEdge).map compositeDiagEdge2Edge(); - setofEdges += edge; - }; - }; - }; - - return setofEdges; -} - -helper setEdgesForStateDiagram (in contained : OrderedSet(di2::DiagramElement)) : OrderedSet (notation::Edge) -{ - var setofEdges : OrderedSet(notation::Edge); - var edge : notation::Edge; - contained->forEach (node|node.oclIsTypeOf(di2::GraphEdge)) { - edge := node.oclAsType(di2::GraphEdge).map stateDiagEdge2Edge(); - setofEdges += edge; - }; - contained->forEach (composite|composite.oclIsTypeOf(di2::GraphNode)) { - composite.oclAsType(di2::GraphNode).contained->forEach (elem|elem.oclIsTypeOf(di2::GraphEdge)) { - edge := elem.oclAsType(di2::GraphEdge).map stateDiagEdge2Edge(); - setofEdges += edge; - }; - composite.oclAsType(di2::GraphNode).contained->forEach (prop|prop.oclIsTypeOf(di2::GraphNode)) { - prop.oclAsType(di2::GraphNode).contained->forEach (connect|connect.oclIsTypeOf(di2::GraphEdge)) { - edge := connect.oclAsType(di2::GraphEdge).map stateDiagEdge2Edge(); - setofEdges += edge; - }; - }; - }; - - return setofEdges; -} - --------------------------------- ---Helpers related to a diagram -helper setStylesForDiagram() : OrderedSet (notation::Style) -{ - -- - - var setofStyles : OrderedSet(notation::Style); - var style := object notation::DiagramStyle { - --the id is set automatically - }; - - setofStyles := OrderedSet{style}; - - return setofStyles; -} \ No newline at end of file diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ElementType.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ElementType.qvto deleted file mode 100644 index b54734ce946..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ElementType.qvto +++ /dev/null @@ -1,25 +0,0 @@ ---Author Manel Fredj-CEA LIST - -library ElementType; - ---diagram types in notation (Papyrus MDT -- P2) -property ClassDiagram_P2 : String = "PapyrusUMLClassDiagram"; -property ProfileDiagram_P2 : String = "PapyrusUMLProfileDiagram"; -property CompositeStructure_P2 : String = "CompositeStructure"; -property ActivityDiagram_P2 : String = "PapyrusUMLActivityDiagram"; -property SequenceDiagram_P2 : String = "PapyrusUMLSequenceDiagram"; --todo: check for papyrus 2 the actual name -property ComponentDiagram_P2 : String = ""; --todo: check for papyrus 1 the actual name -property StateMachineDiagram_P2 : String = "PapyrusUMLStateMachineDiagram"; -property UseCaseDiagram_P2 : String = "UseCase"; - ---diagram types in di2 (Papyrus 1 -- P1) -property ClassDiagram_P1 : String = "ClassDiagram"; --- property ProfileDiagram_P1 --no specific diagram in P1 (class diagram), getDiagramType returns code in function of UML model -property CompositeStructure_P1 : String = "CompositeStructureDiagram"; -property ActivityDiagram_P1 : String = "ActivityDiagram"; -property SequenceDiagram_P1 : String = "SequenceDiagram"; -property ComponentDiagram_P1 : String = "ComponentDiagram"; -property StateMachineDiagram_P1 : String = "StateMachineDiagram"; -property UseCaseDiagram_P1 : String = "UseCaseDiagram"; --- does not exist in MDT --- property DeploymentDiagram_P1 : String = "DeploymentDiagram"; \ No newline at end of file diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/GeneralMappingsandHelpers.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/GeneralMappingsandHelpers.qvto deleted file mode 100644 index becc23eefc9..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/GeneralMappingsandHelpers.qvto +++ /dev/null @@ -1,136 +0,0 @@ ---Author Manel Fredj-CEA LIST -library GeneralMappings; - -import Converter.Utils.ConverterLibs; -import NotationQueries; - - -modeltype di2 uses 'http://www.papyrusuml.org/di2'; -modeltype notation uses 'http://www.eclipse.org/gmf/runtime/1.0.2/notation'; -modeltype ecore uses 'http://www.eclipse.org/emf/2002/Ecore'; -modeltype uml uses 'http://www.eclipse.org/uml2/2.1.0/UML'; - - -------------------------------------------------------------------------------------------------------------------------- ----------------------------------------- Generic Mappings --------------------------------------- -------------------------------------------------------------------------------------------------------------------------- -abstract mapping di2::GraphElement::element2View() : notation::View -{ - --assign visibility attribute (it seems that this is not supported by Papyrus MDT - -- if false, diagram is visible but has no contents - --visible := self.isVisible; - visible := true; - - element := self.getElement().oclAsType(ecore::EObject); -} - - -mapping di2::GraphEdge::edge2Connector() : notation::Connector inherits di2::GraphElement::element2View -{ - lineColor := self.borderColor.rgb2int(); -} - -mapping di2::GraphNode::node2Shape() : notation::Shape inherits di2::GraphElement::element2View -{ - --assign colors and bounds - lineColor := self.borderColor.rgb2int(); - fillColor := self.backgroundColor.rgb2int(); - fontColor := self.fontColor.rgb2int(); - - layoutConstraint := object notation::Bounds { - var size : notation::Size := self.oclAsType(di2::GraphNode).size.map dimension2Size(); - - var relativeLocation: notation::Location :=null; - - var location : notation::Location := self.position.map point2Location(); - x := location.x; - y := location.y; - width := size.width; - height := size.height; - if (self.container.oclIsTypeOf(di2::GraphNode)) then { - // correct position (why necessary??) of nested items - y := y - 20; - } endif; - } -} - -------------------------------------------------------------------------------------------------------------------------- ----------------------------------------- Mappings --------------------------------------- -------------------------------------------------------------------------------------------------------------------------- - -mapping di2::Dimension::dimension2Size() : notation::Size -{ - width := self.dimensionGetWidth(); - height := self.dimensionGetHeight(); -} - --- transformation mapping dimension into location -mapping di2::Point::point2Location() : notation::Location -{ - x := self.pointGetX(); - y := self.pointGetY(); - -} - -------------------------------------------------------------------------------------------------------------------------- ----------------------------------------- Helpers --------------------------------------- -------------------------------------------------------------------------------------------------------------------------- - - ---Set EAnnotation: not specific to a diagram (it is used in class diagram and composite diagram) --------------------------------- -helper setEAnnotations() : OrderedSet (ecore::EAnnotation) -{ - -- first eAnnotation - var eAnnot1 := object ecore::EAnnotation { - --the id is set automatically - --eAnnot1.eModelElement:=self.resolveone(notation::Node); - source := "ShadowFigure"; - details := object ecore::EStringToStringMapEntry { - key := "ShadowFigure_Value"; - value := "false"; - }; - }; - - -- second annotation - var eAnnot2 := object ecore::EAnnotation { - --the id is set automatically - source := "displayNameLabelIcon"; - details := object ecore::EStringToStringMapEntry { - key := "displayNameLabelIcon_value"; - value := "false"; - }; - }; - - -- third annotation - var eAnnot3 := object ecore::EAnnotation { - -- the id is set automatically - source := "QualifiedName"; - details := object ecore::EStringToStringMapEntry { - key := "QualifiedNameDepth"; - value := "1000"; - }; - }; - - -- add the set of annotations to the node - return OrderedSet { - eAnnot1, eAnnot2, eAnnot3 - }; -} - ---suppresses showing type information for an element (used for associations by default) -helper noTypeEAnnotation() : OrderedSet (ecore::EAnnotation) -{ - var eAnnotationNoType := object ecore::EAnnotation { - --the id is set automatically - --eAnnot1.eModelElement:=self.resolveone(notation::Node); - source := "CustomAppearance_Annotation"; - details := object ecore::EStringToStringMapEntry { - key := "CustomAppearance_MaskValue"; - value := "14"; - }; - }; - return OrderedSet { - eAnnotationNoType - }; -} \ No newline at end of file diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/NotationQueries.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/NotationQueries.qvto deleted file mode 100644 index 83f1850a146..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/NotationQueries.qvto +++ /dev/null @@ -1,168 +0,0 @@ - ---Author Manel Fredj-CEA LIST - -import ElementType; -import Converter.Utils.ConverterLibs; // for getElement - -modeltype di uses 'http://www.eclipse.org/papyrus/0.7.0/sashdi'; -modeltype di2 uses 'http://www.papyrusuml.org/di2'; -modeltype notation uses 'http://www.eclipse.org/gmf/runtime/1.0.2/notation'; -modeltype ecore uses 'http://www.eclipse.org/emf/2002/Ecore'; -modeltype uml uses 'http://www.eclipse.org/uml2/2.1.0/UML'; - - -transformation Transfo(in src : di2, out target1 : notation, out target2:di); - - -------------------------------------------------------------------------------------------------------------------------- ----------------------------------------- QUERIES for notation --------------------------------------- -------------------------------------------------------------------------------------------------------------------------- - -// in Java already ---query di2::RGB::RGB2Int() : Integer ---{ --- return 0; --- -- TODO: check the conversion form RGB to int ---} - - -query di2::Diagram::getDiagramtype() : String -{ - --class diagram - if (self.type = ClassDiagram_P1) then { - if (self.getElement().oclIsTypeOf(uml::Profile)) then { - return ProfileDiagram_P2.oclAsType(String); - } - else { - return ClassDiagram_P2.oclAsType(String); - } endif; - } endif; - --composite diagram - if (self.type = CompositeStructure_P1) then { - return CompositeStructure_P2.oclAsType(String); - } endif; - --activity diagram - if (self.type = ActivityDiagram_P1) then { - return ActivityDiagram_P2.oclAsType(String); - } endif; --TODO: check for papyrus 1 le type - --sequence diagram - if (self.type = SequenceDiagram_P1) then { - return SequenceDiagram_P2.oclAsType(String); - } endif; - --component diagram - if (self.type = ComponentDiagram_P1) then { - return ComponentDiagram_P1.oclAsType(String); - } endif; --TODO: check for papyrus 2 le type - --state Machine diagram - if (self.type = StateMachineDiagram_P1) then { - return StateMachineDiagram_P2; - } endif; - --Use case diagram - if (self.type = UseCaseDiagram_P1) then { - return UseCaseDiagram_P2; - } endif; - --otherwise - return null; -} - -query di2::GraphElement::getDiagramtype() : String { - var parent : Stdlib::Element := self.container(); - - if (parent.oclIsTypeOf (di2::Diagram)) then { - return parent.oclAsType (di2::Diagram).getDiagramtype(); - } - else { - if (parent.oclIsTypeOf (di2::GraphElement)) then { - return parent.oclAsType (di2::GraphElement).getDiagramtype(); - } endif; - } endif; - return null; -} - -query di2::GraphNode::getOperations() : OrderedSet(ecore::EObject) -{ - return self.getSubElementsOfType("Operation"); -} - - -query di2::GraphNode::getProperties() : OrderedSet(ecore::EObject) -{ - return self.getSubElementsOfType("Property"); -} - -query di2::GraphNode::getEnumLiterals() : OrderedSet(ecore::EObject) -{ - return self.getSubElementsOfType("EnumerationLiteral"); -} - -query di2::GraphNode::getSubElementsOfType(type : String) : OrderedSet(ecore::EObject) -{ - var containedSubElements : OrderedSet(ecore::EObject); - var elem : uml::Element; - - self.contained->forEach (node|node.oclIsTypeOf(di2::GraphNode)) { - - if (node.oclAsType(di2::GraphNode).contained != null) then - { - var contained:OrderedSet(di2::DiagramElement) := node.oclAsType(di2::GraphNode).contained; - contained->forEach (op|op.oclIsTypeOf(di2::GraphNode)){ - elem := op.oclAsType(di2::GraphNode).semanticModel.oclAsType(di2::Uml1SemanticModelBridge).element; - if (elem.metaClassName() = type) then { - containedSubElements += elem.oclAsType(ecore::EObject); - } endif; - }; - } endif; - }; - return containedSubElements; -} - -query di2::GraphNode::getClassifierTemplateParameter():OrderedSet(ecore::EObject){ - --containedCTPs stands for contained "Classifier Template Parameters" - var containedCTPs: OrderedSet(ecore::EObject); - var elem : uml::Element; - - self.contained->forEach (node|node.oclIsTypeOf(di2::GraphNode)){ - node.oclAsType(di2::GraphNode).contained->forEach(subnode|subnode.oclIsTypeOf(di2::GraphNode)) { - elem:=subnode.oclAsType(di2::GraphNode).getElement(); - if (elem.oclIsTypeOf(uml::ClassifierTemplateParameter)) then { - containedCTPs += elem.oclAsType(ecore::EObject); - } endif; - }; - }; - - return containedCTPs; -} - -query di2::GraphNode::getSemanticParent(): di2::DiagramElement { - - if (self.getElement().oclIsTypeOf(uml::RedefinableTemplateSignature)) then { - return self.semanticParent; - } endif; - - if (self.getElement().oclIsTypeOf(uml::Port))then{ - return self.semanticParent; - } endif; - - return null; -} - -query di2::GraphNode::getSubElementsOfPackage() : OrderedSet(di2::GraphNode) -{ - var containedElements : OrderedSet(di2::GraphNode); - - self.contained->forEach (node|node.oclIsTypeOf(di2::GraphNode)) { - if (node.oclAsType(di2::GraphNode).getElement().oclIsKindOf(uml::Element)) then - { - containedElements +=node.oclAsType(di2::GraphNode); - } endif; - }; - return containedElements; -} - -query di2::GraphEdge::getAnchors() -{ - var anchors:OrderedSet (di2::GraphConnector):= self.anchor; - anchors->forEach (gc) { - --log("the anchor is " + gc.metaClassName()); - }; -} \ No newline at end of file diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ProfileDiagNodes.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ProfileDiagNodes.qvto deleted file mode 100644 index 162d0f27d1b..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ProfileDiagNodes.qvto +++ /dev/null @@ -1,273 +0,0 @@ ---Author Ansgar Radermacher - CEA LIST -library ProfileDiagram; - -import Converter.Utils.ConverterLibs; -import ProfileDiagVisualIDs; -import GeneralMappingsandHelpers; - - -modeltype di2 uses 'http://www.papyrusuml.org/di2'; -modeltype notation uses 'http://www.eclipse.org/gmf/runtime/1.0.2/notation'; -modeltype ecore uses 'http://www.eclipse.org/emf/2002/Ecore'; -modeltype uml uses 'http://www.eclipse.org/uml2/2.1.0/UML'; - - -mapping di2::GraphNode::profileDiagNode2Shape() : notation::Shape inherits di2::GraphNode::node2Shape -{ - --add 3 eAnnotations as in class diagram - eAnnotations := setEAnnotations (); - - if (self.getElement().oclIsTypeOf(uml::Stereotype)) then { - type := VisualId_Stereotype; - children := setChildrenForStereotype(self); - } endif; - if (self.getElement().oclIsTypeOf(uml::ElementImport)) then { - // TODO: in Papyrus 1, meta-classes refer to element imports, but not all element imports are meta-classes - type := VisualId_Metaclass; - children := setChildrenForMetaclass(self); - // replace element import by meta-class reference - element := self.getSemanticModel().getMetaclassRef().oclAsType(ecore::EObject); - } endif; - if (self.getElement().oclIsTypeOf(uml::Comment)) then { - type := VisualId_Comment; - children := setChildrenForComment(self); - } endif; - if (self.getElement().oclIsTypeOf(uml::Package)) then { - type := VisualId_Package; - children := setChildrenForPackage(self); - } endif; - if (self.getElement().oclIsTypeOf(uml::Profile)) then { - type := VisualId_Profile; - children := setChildrenForProfile(self); - } endif; - if (self.getElement().oclIsTypeOf(uml::DataType)) then { - type := VisualId_DataType; - children := setChildrenForDataType(self); - } endif; - if (self.getElement().oclIsTypeOf(uml::Enumeration)) then { - type := VisualId_Enum; - children := setChildrenForEnum(self); - } endif; -} - - ---------------------------------------------------------------------------- ---set children for stereotype - -helper setChildrenForStereotype(in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_Stereotype_DecoNode; - --the id is set automatically - }; - - -- second child - var child2 := object notation::BasicCompartment { - type := VisualId_Stereotype_Label; - styles := OrderedSet { - object notation::SortingStyle { }, - object notation::FilteringStyle { } - }; - layoutConstraint := object notation::Bounds {}; - }; - - -- third child - var child3 := object notation::BasicCompartment { - type := VisualId_Stereotype_Compartment; - --set children as properties - children:= setPropertiesForStereotype(node.contained); - layoutConstraint := object notation::Bounds {}; - }; - - return OrderedSet { - child1, child2, child3 - }; -} - ---in contained attributes: properties or nested classes -helper setPropertiesForStereotype(in contained:OrderedSet(di2::DiagramElement)) : OrderedSet(notation::Node) -{ - var setOfChildren : OrderedSet(notation::Node); - --var child : notation::Node; - - contained ->forEach (node|node.oclIsTypeOf(di2::GraphNode)) { - node.oclAsType(di2::GraphNode).contained->forEach (subNode|subNode.oclIsTypeOf(di2::GraphNode)) { - if(subNode.oclAsType(di2::GraphNode).getElement().oclIsTypeOf(uml::Property)) then { - var child : notation::Shape := subNode.oclAsType(di2::GraphNode).map stereotype2Property(); - -- var child : notation::Shape; - setOfChildren += child; - } endif; - }; - }; - - return setOfChildren; -} - ------------------------------------------------------------------------------ --- case of properties -mapping di2::GraphNode::stereotype2Property() : notation::Shape { - - type := VisualId_StereotypeProperty; - - --set element - element := self.getElement().oclAsType(ecore::EObject); - - --set size and width and high - layoutConstraint := object notation::Bounds { - var size : notation::Size := self.size.map dimension2Size(); - var location : notation::Location := self.oclAsType(di2::GraphNode).position.map point2Location(); - x := location.x; - y := location.y; - width := size.width; - height := size.height; - }; -} - - -helper setChildrenForMetaclass(in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_Metaclass_DecoNode; - --the id is set automatically - }; - - return OrderedSet { - child1 - }; -} - -helper setChildrenForComment(in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_Comment_DecoNode; - --the id is set automatically - }; - - return OrderedSet { - child1 - }; -} - -helper setChildrenForProfile(in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_Profile_DecoNode1; - }; - var child2 := object notation::DecorationNode { - type := VisualId_Profile_DecoNode2; - - var containedElements : OrderedSet(di2::GraphNode) := node.getSubElementsOfPackage(); - containedElements->forEach (containedElement) { - var shape : notation::Shape ::= containedElement.map profileDiagNode2Shape(); - children += shape; - }; - }; - - return OrderedSet { - child1, child2 - }; -} - -helper setChildrenForPackage(in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_Package_DecoNode1; - }; - var child2 := object notation::DecorationNode { - type := VisualId_Package_DecoNode2; - var containedElements : OrderedSet(di2::GraphNode) := node.getSubElementsOfPackage(); - containedElements->forEach (containedElement) { - var shape : notation::Shape ::= containedElement.map profileDiagNode2Shape(); - children += shape; - }; - }; - - return OrderedSet { - child1, child2 - }; -} - ---------------------------------------------------------------------------- ---set children for enumeration -helper setChildrenForEnum(in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - var childrenOfStereotype: OrderedSet(notation::Node); - - -- - - -- - -- - -- - - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_Enum_DecoNode; - --the id is set automatically - }; - - -- second child - var child2 := object notation::BasicCompartment { - type := VisualId_Enum_BasicCompartment; - children := getEnumLiterals(node); - layoutConstraint := object notation::Bounds {}; - }; - - childrenOfStereotype := OrderedSet { - child1, child2 - }; - - --convert edges in the composite - - return childrenOfStereotype; -} - ---for enumeration literals -helper getEnumLiterals(in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - var enumLiteralsShape : OrderedSet(notation::Node); - var enumLiterals : OrderedSet(ecore::EObject) := node.getEnumLiterals(); - enumLiterals->forEach (enumLiteral) { - var enumLiteralShape := object notation::Shape { - type := VisualId_EnumLiteral; - --fontName="Sans Serif"; - --lineColor="0"; - element := enumLiteral; - layoutConstraint := object notation::Location{}; - }; - enumLiteralsShape += enumLiteralShape; - }; - - return enumLiteralsShape; -} - -helper setChildrenForDataType(in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_DataType_DecoNode; - }; - - -- second child - var child2 := object notation::BasicCompartment { - type := VisualId_DataType_CompartmentAttr; - --TODO set children - layoutConstraint := object notation::Bounds {}; - }; - - -- third child - var child3 := object notation::BasicCompartment { - type := VisualId_DataType_CompartmentOper; - --set children as properties - --children:= setPropertiesForStereotype(node.contained); - layoutConstraint := object notation::Bounds {}; - }; - - return OrderedSet { - child1, child2, child3 - }; -} diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ProfileDiagVisualIDs.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ProfileDiagVisualIDs.qvto deleted file mode 100644 index 3fa75c813ef..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/ProfileDiagVisualIDs.qvto +++ /dev/null @@ -1,55 +0,0 @@ - ---Author Ansgar Radermacher-CEA LIST - -library ProfileDiagVisualIDs; - ---profile -property VisualId_Profile : String = "1030"; -property VisualId_Profile_DecoNode1 : String = "1047"; -property VisualId_Profile_DecoNode2 : String = "1042"; - ---package -property VisualId_Package : String = "2007"; -property VisualId_Package_DecoNode1 : String = "5026"; -property VisualId_Package_DecoNode2 : String = "1005"; - ---profile in package (currently unused) -property VisualId_NestedProfile : String = "1024"; -property VisualId_NestedProfile_DecoNode1 : String = "1050"; -property VisualId_NestedProfile_DecoNode2 : String = "1051"; - ---package in package (currently unused) -property VisualId_NestedPackage : String = "1012"; -property VisualId_NestedPackage_DecoNode1 : String = "1010"; -property VisualId_NestedPackage_DecoNode2 : String = "11"; - ---enumeration -property VisualId_Enum : String = "2006"; -property VisualId_Enum_DecoNode : String = "5023"; -property VisualId_Enum_BasicCompartment : String = "1063"; -property VisualId_EnumLiteral : String = "1037"; - ---stereotype -property VisualId_Stereotype : String = "1026"; -property VisualId_Stereotype_DecoNode : String = "1034"; -property VisualId_Stereotype_Label : String = "1019"; -property VisualId_Stereotype_Compartment : String = "1071"; - ---datatype -property VisualId_DataType : String = "2010"; -property VisualId_DataType_DecoNode : String = "5035"; -property VisualId_DataType_CompartmentAttr : String = "1067"; -property VisualId_DataType_CompartmentOper : String = "1068"; - ---property in stereotype -property VisualId_StereotypeProperty : String = "3002"; -property VisualId_StereotypeProperty_Label : String = "5001"; -property VisualId_StereotypeProperty_Compartment : String = "5002"; - ---metaclass -property VisualId_Metaclass : String = "1031"; -property VisualId_Metaclass_DecoNode : String = "1084"; - ---comment -property VisualId_Comment : String = "1002"; -property VisualId_Comment_DecoNode : String = "3"; diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/StateDiagEdges.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/StateDiagEdges.qvto deleted file mode 100644 index bfbe84eb39b..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/StateDiagEdges.qvto +++ /dev/null @@ -1,160 +0,0 @@ ---Author Manel Fredj-CEA LIST - -library HelpersEdge; -import GeneralMappingsandHelpers; -import StateDiagVisualIDs; - -modeltype di2 uses 'http://www.papyrusuml.org/di2'; -modeltype notation uses 'http://www.eclipse.org/gmf/runtime/1.0.2/notation'; -modeltype uml uses 'http://www.eclipse.org/uml2/2.1.0/UML'; - -mapping di2::GraphEdge::stateDiagEdge2Edge() : notation::Connector inherits di2::GraphEdge::edge2Connector -{ - ----------------------------------------------------------------------- - --under an Edge "association" - ----------------------------------------------------------------------- - --In the case that we have an association we will have: - --1 edge with a xmi:type:="notation:Connector", a geneerated Id, type= "4001", a target and a source that includes: - -- 6 "children" typed with decoration nodes - -- 1 "styles - -- 1 element - -- 1 bendpoints - --1 sourceAnchor - --1targetAnchor - ----------------------------------------------------------------------- - - --setting the type and children - if (self.getElement() != null) then { - - if (self.getElement().oclIsTypeOf(uml::Transition)) then { - type := VisualId_Edge_Transition; - --adding children - children := setChildrenForTransition(); - } endif; - } - else { - --type := VisualId_Edge_Link; - --adding children - } endif; - - --setting the source and target Anchors - var anchors : OrderedSet (di2::GraphConnector) := self.anchor; - anchors->forEach (gc) { - --log("the anchor is "+ gc.graphElement.repr()); - gc.graphElement; - }; - source := anchors->first().graphElement.oclAsType(di2::GraphNode).late resolveone(notation::Shape); - target := anchors->last().graphElement.oclAsType(di2::GraphNode).late resolveone(notation::Shape); - --adding style - styles := setStyleForEdge(); - - --adding element: already done in View - - --adding the bend points - bendpoints := setBendpointsForEdge(); - - --adding the source and target Anchor - sourceAnchor := setSourceAnchor(); - targetAnchor := setTargetAnchor(); -} - - ---Helpers related to an Edge --------------------------------- - - ---generic helper for an edge with two children ---takes as input the visual ids of the the two children - -helper setChildrenForEdge2Children(in VisualId1: String, in VisualId2: String): OrderedSet(notation::Node) -{ - var child1 := object notation::DecorationNode { - --the id is set automatically - type := VisualId1; - layoutConstraint := object notation::Location { - y := 40; - }; - }; - - --second child - var child2 :=object notation::DecorationNode { - --the id is set automatically - type := VisualId2; - layoutConstraint := object notation::Location { - y := 60; - }; - }; - - return OrderedSet {child1,child2}; -} - - -helper setChildrenForTransition(): OrderedSet(notation::Node) -{ - -- - -- - -- - - var child1 := object notation::DecorationNode { - --the id is set automatically - --type := VisualId_DecoNodeGeneralization; - type := VisualId_Edge_Transition_DecoNode1; - layoutConstraint := object notation::Location { - y := 10; - }; - }; - var child2 := object notation::DecorationNode { - --the id is set automatically - --type := VisualId_DecoNodeGeneralization; - type := VisualId_Edge_Transition_DecoNode2; - layoutConstraint := object notation::Location { - y := 20; - }; - }; - var child3 := object notation::DecorationNode { - --the id is set automatically - --type := VisualId_DecoNodeGeneralization; - type := VisualId_Edge_Transition_DecoNode3; - layoutConstraint := object notation::Location { - y := 20; - }; - }; - - return OrderedSet { - child1, child2, child3 - }; -} - - -helper setStyleForEdge() : OrderedSet(notation::Style) -{ - -- - var style := object notation::FontStyle { - --the id is set automatically - --fontName="Sans Serif"; - }; - - return OrderedSet{style}; -} - -helper setSourceAnchor() : notation::Anchor -{ - return object notation::IdentityAnchor { }; -} - - -helper setTargetAnchor():notation::Anchor -{ - return object notation::IdentityAnchor { }; -} - - -helper setBendpointsForEdge():notation::RelativeBendpoints -{ - -- - // var pts : notation::RelativeBendpointList; - // var bendpoints:=object notation::RelativeBendpoints { }; - var bendpoints := createBendpoints().oclAsType (notation::RelativeBendpoints); - - return bendpoints; -} \ No newline at end of file diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/StateDiagNodes.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/StateDiagNodes.qvto deleted file mode 100644 index 60802fb3c3f..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/StateDiagNodes.qvto +++ /dev/null @@ -1,308 +0,0 @@ ---Author Manel Fredj-CEA LIST -library StateDiagram; - -import Converter.Utils.ConverterLibs; -import StateDiagVisualIDs; -import GeneralMappingsandHelpers; - - -modeltype di2 uses 'http://www.papyrusuml.org/di2'; -modeltype notation uses 'http://www.eclipse.org/gmf/runtime/1.0.2/notation'; -modeltype ecore uses 'http://www.eclipse.org/emf/2002/Ecore'; -modeltype uml uses 'http://www.eclipse.org/uml2/2.1.0/UML'; - - -mapping di2::GraphNode::stateDiagNode2Shape() : notation::Shape inherits di2::GraphNode::node2Shape -{ - --add 3 eAnnotations as in class diagram - eAnnotations := setEAnnotations (); - - if (self.getElement().oclIsTypeOf(uml::State)) then { - type := VisualId_State; - children := setChildrenForState(self); - } endif; - if (self.getElement().oclIsTypeOf(uml::StateMachine)) then { - type := VisualId_StateMachine; - children := setChildrenForStateMachine(self); - } endif; - if (self.getElement().oclIsTypeOf(uml::Comment)) then { - -- type := VisualId_Comment; - } endif; - if (self.getElement().oclIsTypeOf(uml::Region)) then { - type := VisualId_Region; - children := setChildrenForRegion(self); - eAnnotations += object ecore::EAnnotation { - source := "RegionAnnotationKey"; - details := object ecore::EStringToStringMapEntry { - key := "RegionZoneKey"; - value := ""; - }; - }; - } endif; - if (self.getElement().oclIsTypeOf(uml::FinalState)) then { - type := VisualId_FinalState; - children := setChildrenForPseudoState (self, VisualId_FinalState_DecoNode1, VisualId_FinalState_DecoNode2); - } endif; - if (self.getElement().oclIsTypeOf(uml::ConnectionPointReference)) then { - type := VisualId_ConnectionPoint; - children := setChildrenForPseudoState (self, VisualId_ConnectionPoint_DecoNode1, VisualId_ConnectionPoint_DecoNode2); - } endif; - if (self.getElement().oclIsTypeOf(uml::Pseudostate)) then { - var pseudoState := self.getElement().oclAsType(uml::Pseudostate); - if (pseudoState.kind = uml::PseudostateKind::initial) then { - type := VisualId_InitialState; - children := setChildrenForPseudoState (self, VisualId_InitialState_DecoNode1, VisualId_InitialState_DecoNode2); - } endif; - if (pseudoState.kind = uml::PseudostateKind::shallowHistory) then { - type := VisualId_ShallowHistoryState; - children := setChildrenForPseudoState (self, VisualId_ShallowHistoryState_DecoNode1, VisualId_ShallowHistoryState_DecoNode2); - } endif; - if (pseudoState.kind = uml::PseudostateKind::deepHistory) then { - type := VisualId_DeepHistoryState; - children := setChildrenForPseudoState (self, VisualId_DeepHistoryState_DecoNode1, VisualId_DeepHistoryState_DecoNode2); - } endif; - if (pseudoState.kind = uml::PseudostateKind::choice) then { - type := VisualId_Choice; - children := setChildrenForPseudoState (self, VisualId_Choice_DecoNode1, VisualId_Choice_DecoNode2); - } endif; - if (pseudoState.kind = uml::PseudostateKind::join) then { - type := VisualId_Choice; - children := setChildrenForPseudoState (self, VisualId_Choice_DecoNode1, VisualId_Choice_DecoNode2); - } endif; - if (pseudoState.kind = uml::PseudostateKind::fork) then { - type := VisualId_Fork; - children := setChildrenForPseudoState (self, VisualId_Fork_DecoNode1, VisualId_Fork_DecoNode2); - } endif; - if (pseudoState.kind = uml::PseudostateKind::junction) then { - type := VisualId_Junction; - children := setChildrenForPseudoState (self, VisualId_Junction_DecoNode1, VisualId_Junction_DecoNode2); - } endif; - if (pseudoState.kind = uml::PseudostateKind::terminate) then { - type := VisualId_Terminate; - children := setChildrenForPseudoState (self, VisualId_Terminate_DecoNode1, VisualId_Terminate_DecoNode2); - } endif; - if (pseudoState.kind = uml::PseudostateKind::entryPoint) then { - type := VisualId_EntryPoint; - children := setChildrenForPseudoState (self, VisualId_EntryPoint_DecoNode1, VisualId_EntryPoint_DecoNode2); - } endif; - if (pseudoState.kind = uml::PseudostateKind::exitPoint) then { - type := VisualId_ExitPoint; - children := setChildrenForPseudoState (self, VisualId_ExitPoint_DecoNode1, VisualId_ExitPoint_DecoNode2); - } endif; - } endif; -} - - -helper setChildrenForPseudoState(in node : di2::GraphNode, in visualID1 : String, in visualID2 : String) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := visualID1; - layoutConstraint := object notation::Location { - x := 20 - }; - }; - var child2 := object notation::DecorationNode { - type := visualID2; - layoutConstraint := object notation::Location { - x := 20 - }; - }; - return OrderedSet { - child1, child2 - }; -}; - ---------------------------------------------------------------------------- ---set children for state - -helper setChildrenForState(in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type:=VisualId_State_DecoNode1; - }; - - -- first child - var child2 := object notation::DecorationNode { - type:=VisualId_State_DecoNode2; - }; - /* - -- second child - var child2 := object notation::BasicCompartment { - type:=VisualId_Class_Composite_Compartiment; - --set children as properties - children:= setPropertiesForState(node.contained); - layoutConstraint:=object notation::Bounds {}; - }; - */ - --convert edges in the composite - - return OrderedSet { - child1, child2 - }; -} - -helper setChildrenForStateMachine(in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_StateMachine_DecoNode1; - }; - var child2 := object notation::DecorationNode { - type := VisualId_StateMachine_DecoNode2; - var containedElements : OrderedSet(di2::GraphNode) := node.getSubElementsOfPackage(); - containedElements->forEach (containedElement) { - var shape : notation::Shape ::= containedElement.map stateDiagNode2Shape(); - if (shape.type != "") then { - --don't add invalid IDs - children += shape; - } endif; - }; - }; - - return OrderedSet { - child1, child2 - }; -} - -helper setChildrenForRegion(in node : di2::GraphNode) : OrderedSet(notation::Node) -{ - -- first child - var child1 := object notation::DecorationNode { - type := VisualId_Region_DecoNode; - var containedElements : OrderedSet(di2::GraphNode) := node.getSubElementsOfPackage(); - containedElements->forEach (containedElement) { - var shape : notation::Shape ::= containedElement.map stateDiagNode2Shape(); - if (shape.type != "") then { - --don't add invalid IDs - children += shape; - } endif; - }; - }; - - return OrderedSet { - child1 - }; -} - -/* ---in contrained attributes: properties or nested classes -helper setPropertiesForState(in contained:OrderedSet(di2::DiagramElement)) : OrderedSet(notation::Node) -{ - var setOfChildren:OrderedSet(notation::Node); - var child:notation::Node; - contained ->forEach (node|node.oclIsTypeOf(di2::GraphNode)) { - - if(node.oclAsType(di2::GraphNode).getElement().oclIsTypeOf(uml::Property)) then { - child := node.oclAsType(di2::GraphNode).map ComponentClass2Property(); - setOfChildren += child; - } endif; - if (node.oclAsType(di2::GraphNode).getElement().oclIsTypeOf(uml::Class)) then { - child := node.oclAsType(di2::GraphNode).map ComponentClass2Class(node.oclAsType(di2::GraphNode)); - setOfChildren += child; - } endif; - }; - - return setOfChildren; -} - - ------------------------------------------------------------------------------ --- case of properties -mapping di2::GraphNode::ComponentClass2Property() : notation::Shape { - - type := VisualId_Component_Property ; - --seteAnnotation - eAnnotations := setEAnnotations (); - --setchildren - children:=setChildrenForComponentProperty(); - - --set size and width and high - layoutConstraint := object notation::Bounds { - var size : notation::Size := self.size.map dimension2Size(); - var location : notation::Location := self.oclAsType(di2::GraphNode).position.map point2Location(); - x := location.x; - y := location.y; - width := size.width; - height := size.height; - }; - --set element - element := self.getElement().oclAsType(ecore::EObject); -} - -helper setChildrenForComponentProperty() : OrderedSet(notation::Node) -{ - -- - -- - -- - -- - - -- first child - var child1 := object notation::DecorationNode { - type:=VisualId_Component_Property_Label; - --the id is set automatically - }; - - -- second child - var child2 := object notation::BasicCompartment { - type:=VisualId_Component_Property_Compartiment; - layoutConstraint:=object notation::Bounds {}; - }; - - return OrderedSet {child1, child2}; -} - - ------------------------------------------------------------------------------ --- case of nested classes - -mapping di2::GraphNode::ComponentClass2Class(in node:di2::GraphNode) : notation::Shape { - - type := VisualId_Component_Class; - --seteAnnotation - eAnnotations := setEAnnotations (); - --setchildren - children:=setChildrenForComponentClass(node); - - --set size and width and high - layoutConstraint := object notation::Bounds { - var size : notation::Size := self.size.map dimension2Size(); - var location : notation::Location := self.oclAsType(di2::GraphNode).position.map point2Location(); - x := location.x; - y := location.y; - width := size.width; - height := size.height; - }; - - --set element - element := self.getElement().oclAsType(ecore::EObject); -} - -helper setChildrenForComponentClass(in node:di2::GraphNode) : OrderedSet(notation::Node) -{ - -- - -- - -- - -- - - -- first child - var child1 := object notation::DecorationNode { - type:=VisualId_Component_Class_Label; - --the id is set automatically - }; - - -- second child - var child2 := object notation::BasicCompartment { - type:=VisualId_Component_Class_Compartiment; - - --set children as properties in the case that the nested class contains properties - children:= setPropertiesForState(node.contained); - layoutConstraint:=object notation::Bounds {}; - }; - - return OrderedSet{child1, child2}; -} - - -*/ \ No newline at end of file diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/StateDiagVisualIDs.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/StateDiagVisualIDs.qvto deleted file mode 100644 index 2ff2ab2c6fb..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/StateDiagVisualIDs.qvto +++ /dev/null @@ -1,84 +0,0 @@ - ---Author Ansgar Radermacher -CEA LIST - -library StateDiagVisualIDs; - ---transition -property VisualId_Edge_Transition : String = "7000"; -property VisualId_Edge_Transition_DecoNode1 : String = "7001"; -property VisualId_Edge_Transition_DecoNode2 : String = "7002"; -property VisualId_Edge_Transition_DecoNode3 : String = "7003"; - ---state machine -property VisualId_StateMachine : String = "2000"; -property VisualId_StateMachine_DecoNode1 : String = "2001"; -property VisualId_StateMachine_DecoNode2 : String = "2002"; - ---region -property VisualId_Region : String = "3000"; -property VisualId_Region_DecoNode : String = "3002"; - ---final state (pseudo state) -property VisualId_FinalState : String = "5000"; -property VisualId_FinalState_DecoNode1 : String = "5001"; -property VisualId_FinalState_DecoNode2 : String = "5002"; - ---state -property VisualId_State : String = "6000"; -property VisualId_State_DecoNode1 : String = "6001"; -property VisualId_State_DecoNode2 : String = "6002"; - ---initial state (pseudo state) -property VisualId_InitialState : String = "8000"; -property VisualId_InitialState_DecoNode1 : String = "8001"; -property VisualId_InitialState_DecoNode2 : String = "8002"; - ---join (pseudo state) -property VisualId_Join : String = "9000"; -property VisualId_Join_DecoNode1 : String = "9001"; -property VisualId_Join_DecoNode2 : String = "9002"; - ---fork (pseudo state) -property VisualId_Fork : String = "10000"; -property VisualId_Fork_DecoNode1 : String = "10001"; -property VisualId_Fork_DecoNode2 : String = "10002"; - ---choice point (pseudo state) -property VisualId_Choice : String = "11000"; -property VisualId_Choice_DecoNode1 : String = "11001"; -property VisualId_Choice_DecoNode2 : String = "11002"; - ---junction (pseudo state) -property VisualId_Junction : String = "12000"; -property VisualId_Junction_DecoNode1 : String = "12001"; -property VisualId_Junction_DecoNode2 : String = "12002"; - ---shallow history state (pseudo state) -property VisualId_ShallowHistoryState : String = "13000"; -property VisualId_ShallowHistoryState_DecoNode1 : String = "13001"; -property VisualId_ShallowHistoryState_DecoNode2 : String = "13002"; - ---deep history state (pseudo state) -property VisualId_DeepHistoryState : String = "14000"; -property VisualId_DeepHistoryState_DecoNode1 : String = "14001"; -property VisualId_DeepHistoryState_DecoNode2 : String = "14002"; - ---termination (pseudo state) -property VisualId_Terminate : String = "15000"; -property VisualId_Terminate_DecoNode1 : String = "15001"; -property VisualId_Terminate_DecoNode2 : String = "15002"; - ---entry point (pseudo state) -property VisualId_EntryPoint : String = "16000"; -property VisualId_EntryPoint_DecoNode1 : String = "16001"; -property VisualId_EntryPoint_DecoNode2 : String = "16002"; - ---exit point (pseudo state) -property VisualId_ExitPoint : String = "17000"; -property VisualId_ExitPoint_DecoNode1 : String = "17001"; -property VisualId_ExitPoint_DecoNode2 : String = "17002"; - ---connection point (pseudo state) -property VisualId_ConnectionPoint : String = "18000"; -property VisualId_ConnectionPoint_DecoNode1 : String = "18001"; -property VisualId_ConnectionPoint_DecoNode2 : String = "18002"; \ No newline at end of file diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/Transfo.qvto b/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/Transfo.qvto deleted file mode 100644 index 52979027ff7..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/TransfoQvtoDi2toDi/Transfo.qvto +++ /dev/null @@ -1,25 +0,0 @@ - ---Author Manel Fredj-CEA LIST - -import DiTransformations; ---import NotationMappingsandHelpers; -import Diagram; - -modeltype di uses 'http://www.eclipse.org/papyrus/0.7.0/sashdi'; -modeltype di2 uses 'http://www.papyrusuml.org/di2'; -modeltype notation uses 'http://www.eclipse.org/gmf/runtime/1.0.2/notation'; - - - -transformation Transfo(in src : di2, out target1 : notation, out target2:di); - -main() { - src.rootObjects()->forEach (e|e.oclIsTypeOf(di2::Diagram)) { - e.oclAsType(di2::Diagram).map diagram2diagram(); - }; - - src.rootObjects()![di2::Diagram]->map diagram2SashWindowsMngr(); -} - - - diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/build.properties b/deprecated/org.eclipse.papyrus.conversion.di2todi/build.properties deleted file mode 100644 index 4cc050a6e8a..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/build.properties +++ /dev/null @@ -1,6 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = plugin.xml,\ - META-INF/,\ - .,\ - TransfoQvtoDi2toDi/ diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/TutorialConversion.html b/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/TutorialConversion.html deleted file mode 100644 index 140e077f5c9..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/TutorialConversion.html +++ /dev/null @@ -1,294 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -

-Tutorial

-

Converter: Diagram Conversion

-

From Papyrus 1 to Papyrus MDT

-

-

Specificities

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Plugin name

org.eclipse.papyrus.conversion.di2todi

Papyrus version

To be used with Papyrus MDT

Status

In progress

(class, composite structure, profile and state diagrams are supported)

Institution

CEA LIST

Authors

Manel Fredj (initial development), Ansgar Radermacher (clean-up/extensions)

Required (Papyrus) plugins

  • org.eclipse.papyrus.conversion.di2

Other Dependencies

    -
  • org.eclipse.m2m.qvt.oml => Install QVT -
  • org.eclipse.ui -
  • org.eclipse.core.runtime -
  • org.eclipse.core.resources -
  • org.eclipse.uml2.uml -
  • org.eclipse.gmf.runtime.notation -
  • org.eclipse.m2m.qvt.oml.emf.util -

Extensions

    -
  • org.eclipse.m2m.qvt.oml.javaBlackboxUnits -
  • org.eclipse.ui.popupMenus -
- -

- -

User Guide

- -This plugin enables to convert diagrams created using papyrus 1.X version -into diagram editable by Papyrus MDT. This Tutorial is twofold: - -
    -
  • First, it includes a user guide in order to convert your diagrams (created - with Papyrus 1.X) into diagrams editable by Papyrus MDT - -
  • Second, it includes a developer guide in order to help developers to extend the - conversion to other diagram not already supported. -
- -

- -

How to use the converter?

- -
    -
  • Add the org.eclipse.papyrus.conversion.di2 + di2todi plugins to your - eclipse configuration. These plugins are provided in the Papyrus SVN - repository under extraplugins/conversion. - -
  • Launch eclipse, including Papyrus MDT. Import your old-version model - created with Papyrus 1.x, let’s call it “Example”. To this aim - you need to import two files: “Example.di2” and “Example.uml”, - as shown in Figure 2. - -
- -
-
- Import Papyrus 1.x Model -
- -
    -
  • Convert your model. To this aim: - Right click on “Example.di2”> in the menu, select “Convert - Diagram”>then, “Di2 to Di Action”, as shown in Figure 3. -
- -
-
- Convert Your Model -
- -
    -
  • After processing, a new model is created, compatible with Papyrus MDT. - Indeed, the conversion creates from the di2 file (i.e., Example.di2) - two new files, namely, “Example.notation” and “Example.di”. - The uml file (i.e., Example.uml) is used to make reference to the - uml graphical elements. At the end of the conversion a message - dialog is opened to inform you of the success or the failure of your - conversion. -
- -
-
- Conversion result -
- -
    -
  • Open the generated di file (i.e., Example.di) to show and edit your - model. -
- -

Internal Process of the conversion

- -This process is performed transparently to user, however, this brief description aims -to provide global overview of the internal process - -

1st Step

-As mentioned in the step2, the diagram -converter requires the di2 namespace to be uniquely defined. To this -aim as a first step of the internal process, the converter changed -the namespace in the di2 file from “http://www.papyrusuml.org” to -“http://www.papyrusuml.org/di2”. - - -This step is meant to be transparent to the user, as the converter -restores the di2 namespace to “http://www.papyrusuml.org” -at the end of the conversion, in order to make your diagram editable -by Papyrus 1.x. However, -if the conversion fails before restoring the original name space, the -old-version model may be no more editable by Papyrus 1.x. Hence, the -user may need to restore it manually by editing the di2 file using a -text editor, and removing the “/di2” from the namespace -http://www.papyrusuml.org/di2. - -

2nd Step

- -As a second step, the converter transforms elements described in the di2 -file into elements in the notation and di files according to their -respective metamodels. - -The di file contains references to the different diagrams in your model. -The notation file contains a specific description of the elements -that are represented graphically in each diagram: size, coordinates, -nested elements, and so on. -To perform this step, the converter performed a set of QVT -(Query/View/Transform) Operation mappings. - -

3rd Step

- -Finally, the converter stores the result of the transformation in to two files, -namely, notation and di file, and restores the di2 namespace to -“http://www.papyrusuml.org”. - -

Supported Conversions

- -Herein, we present two sample conversions and outline the elements supported by the converter. We start -first with the class diagram and then, we detail the transformations in the composite diagram. - -

Class Diagram

- -Tests have been done with class diagrams containing -
    -
  • Simple classes -
  • Class with operations and attributes -
  • Comments -
  • Relationships between classes -
      -
    • Dependency -
    • Association -
    • Link with a comment -
    • Realization -
    • Generalization -
    -
- -The screenshots have been taken with an older version that did not copy color attributes. These are now handled. - -
-
- Class diagram in Papyrus 1.12 (original) -

-
- Class diagram in Papyrus MDT (conversion result) -

- -

Composite Diagram

- -Tests have been done with composite diagrams containing - -
    -
  • Composite classes -
  • Properties within composite classes -
  • Nested classes -
  • Ports -
  • Connection between ports: connector -
- -
-
- Composite diagram in Papyrus 1.12 (original) -

-
- Composite diagram in Papyrus MDT (conversion result) -

- -

Developer guide

- -To convert models from Papyrus 1.x to Papyrus MDT, this plugin uses Q/V/T operational mappings. -The plugin contains additional Java code, it is divided into three parts: -
    -
  • Model Transformation libraries implemented in QVTO -
  • Black Boxes implemented in Java and used by the model transformations -
  • Java code that is used to call the model transformations and extend the eclipse - context menu with the conversion action, i.e., "Convert Diagram". -
- -The main part of the plugin is the model transformation, which includes -
    -
  • General libraries: -
      -
    • ElementType.qvto: names of diagrams in Papyrus 1.12 and MDT. -
    • GeneralMappingsandHelpers.qvto: collection of utilities -
    • NotationQueries.qvto - includes all the queries that are made to the di2 model in order to - be used in the notation model. -
    • Diagram.qvto: convert the supported diagrams, make use of diagram specific - libraries below. -
    • DiTansformation.qvto - enable to create the elements of the di model from the di2 model. -
    - -
  • Diagram specific libraries, prefixed with name of diagram, i.e. <Class>, <Composite>, <State>, - <Profile> and <ClassAndProfile> (the letter is a particular case for edges in class and profile - diagrams which have identical IDs in these two diagram types) -
      -
    • DiagEdge.qvto - that converts all sorts of edges (realization, dependency, - generalization, and so on). -
    • DiagNodes.qvto that converts the node elements of a diagram -
    -
  • The main transformation -
      -
    • Transfo.qvto, which triggers the model transformation. -
    -
diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/conversion-example-di2action.png b/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/conversion-example-di2action.png deleted file mode 100644 index 1e1d021cd66..00000000000 Binary files a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/conversion-example-di2action.png and /dev/null differ diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/conversion-example-project.png b/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/conversion-example-project.png deleted file mode 100644 index 5c11cc12e2e..00000000000 Binary files a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/conversion-example-project.png and /dev/null differ diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/conversion-example-result.png b/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/conversion-example-result.png deleted file mode 100644 index fe3a0e97514..00000000000 Binary files a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/conversion-example-result.png and /dev/null differ diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example-composite-diag-mdt.png b/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example-composite-diag-mdt.png deleted file mode 100644 index ae6b496d0c8..00000000000 Binary files a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example-composite-diag-mdt.png and /dev/null differ diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example-composite-diag-p1.12.png b/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example-composite-diag-p1.12.png deleted file mode 100644 index 0a61e8d5ae5..00000000000 Binary files a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example-composite-diag-p1.12.png and /dev/null differ diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example1-class-diagram-mdt.png b/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example1-class-diagram-mdt.png deleted file mode 100644 index 531381a328e..00000000000 Binary files a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example1-class-diagram-mdt.png and /dev/null differ diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example1-class-diagram-p1.12.png b/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example1-class-diagram-p1.12.png deleted file mode 100644 index 726a5582f1b..00000000000 Binary files a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example1-class-diagram-p1.12.png and /dev/null differ diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example2-class-diagram-mdt.png b/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example2-class-diagram-mdt.png deleted file mode 100644 index c8112529635..00000000000 Binary files a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example2-class-diagram-mdt.png and /dev/null differ diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example2-class-diagram-p1.12.png b/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example2-class-diagram-p1.12.png deleted file mode 100644 index 8a9e3e5e824..00000000000 Binary files a/deprecated/org.eclipse.papyrus.conversion.di2todi/doc/figs/example2-class-diagram-p1.12.png and /dev/null differ diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/plugin.properties b/deprecated/org.eclipse.papyrus.conversion.di2todi/plugin.properties deleted file mode 100644 index 1803ba8aee5..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/plugin.properties +++ /dev/null @@ -1,12 +0,0 @@ -################################################################################# -# Copyright (c) 2011 CEA LIST. -# 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 -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Manel Fredj, Ansgar Radermacher - Initial API and implementation -################################################################################## -pluginName=di2 to di conversion (Papyrus 1.x to Papyrus MDT) -providerName=Eclipse Modeling Project diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/plugin.xml b/deprecated/org.eclipse.papyrus.conversion.di2todi/plugin.xml deleted file mode 100644 index 484692c3519..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/plugin.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/Activator.java b/deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/Activator.java deleted file mode 100644 index c660b3cea70..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/Activator.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.eclipse.papyrus.conversion.di2todi; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.papyrus.conversion.di2todi"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given - * plug-in relative path - * - * @param path the path - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String path) { - return imageDescriptorFromPlugin(PLUGIN_ID, path); - } -} diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/blackboxes/UtilitiesLibrary.java b/deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/blackboxes/UtilitiesLibrary.java deleted file mode 100644 index 9138b043865..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/blackboxes/UtilitiesLibrary.java +++ /dev/null @@ -1,236 +0,0 @@ -/** - * @author: Manel Fredj - CEA - * This class includes all the operations that are called in the transformation QVTO from java. - * These operations are wrapped into a black-box - */ - -package org.eclipse.papyrus.conversion.di2todi.blackboxes; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.RelativeBendpoints; -import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint; -import org.eclipse.m2m.qvt.oml.blackbox.java.Operation; -import org.eclipse.papyrus.conversion.di2.GraphElement; -import org.eclipse.papyrus.conversion.di2.SemanticModelBridge; -import org.eclipse.papyrus.conversion.di2.Uml1SemanticModelBridge; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.uml2.uml.Association; -import org.eclipse.uml2.uml.Dependency; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.ElementImport; -import org.eclipse.uml2.uml.Generalization; -import org.eclipse.uml2.uml.Realization; - -public class UtilitiesLibrary { - - @Operation(contextual=true) - public static String getName(Diagram self) - { - return self.getName(); - } - - @Operation(contextual=true) - public static EObject convertElement(Element self) - { - return self; - } - - @Operation(contextual=true) - public static String getElementType(Element self) - { - if (self instanceof Association ) - return "Association"; - if (self instanceof Generalization ) - return "Generalization"; - else return null; - } - - @Operation(contextual=true) - public static boolean isGeneralization(Element self) - { - if (self instanceof Generalization) - return true; - else return false; - } - - - @Operation(contextual=true) - public static boolean isAssociation(Element self) - { - if (self instanceof Association) - return true; - else - return false; - } - - @Operation(contextual=true) - public static boolean isRealization(Element self) - { - if (self instanceof Realization) - return true; - else - return false; - } - @Operation(contextual=true) - public static boolean isDependency(Element self) - { - if (self instanceof Dependency) - return true; - else - return false; - } - - @Operation(contextual=true) - public static int dimensionGetWidth(Dimension self) - { - if (self!=null) - return self.width; - else - return 0; - } - - @Operation(contextual=true) - public static int dimensionGetHeight(Dimension self) - { - if (self!=null) - return self.height; - else - return 0; - } - - @Operation(contextual=true) - public static int pointGetX(Point self) - { - if (self!=null) - { - - return self.x; - }else - return 0; - } - - @Operation(contextual=true) - public static int pointGetY(Point self) - { - if (self!=null) - { - return self.y; - } - else - return 0; - } - - @Operation(contextual=true) - public static String showcoordinates(Point self) - { - if (self!=null) - { - return "the x is "+ self.x+ "and the y is "+ self.y; - } - else - return "nothing to display"; - } - - @Operation(contextual=true) - public static int rgb2int(RGB self) - { - if (self!=null) - return self.blue * 0x10000 + self.green *0x100 + self.red; - else - return 0; - } - - @Operation(contextual=true) - public static Element getElement(Uml1SemanticModelBridge bridge) { - // difference to using element attribute directly: getElement will try to resolve proxies - // and thus detects elements referenced by the di2 model that do not exist (anymore) in the - // uml model - Element element = bridge.getElement(); - if ((element != null) && element.eIsProxy()) { - // is still proxy (the getElement implementation of Uml1SemanticModelBridge already tried to - // resolve) => return null - return null; - } - else { - return element; - } - } - - /** - * Return the semantic model for a given di2 element - * @param di2Element existing di2 element - * @return the associated semantic model or null - */ - @Operation(contextual=true) - public static Uml1SemanticModelBridge getSemanticModel(GraphElement di2Element) { - SemanticModelBridge semanticModel; - if (di2Element instanceof org.eclipse.papyrus.conversion.di2.Diagram) { - semanticModel =((org.eclipse.papyrus.conversion.di2.Diagram) di2Element).getOwner(); - } - else { - semanticModel = di2Element.getSemanticModel(); - } - if (semanticModel instanceof Uml1SemanticModelBridge) { - return (Uml1SemanticModelBridge) semanticModel; - } - return null; - } - - @Operation(contextual=true) - public static Element getElement(GraphElement di2Element) { - - Uml1SemanticModelBridge semanticModel = getSemanticModel(di2Element); - if (semanticModel != null) { - return getElement (semanticModel); - } - else { - System.err.println("no bridge found for di2Node" + di2Element); - } - return null; - } - - // may be useful for debugging (use it instead of getElement in combination with a breakpoint) - @Operation(contextual=true) - public static Element getElementDebug(GraphElement di2Element) { - - Element element = getElement(di2Element); - return element; - } - - /** - * Papyrus 1 profile diagrams do not reference meta-class elements directly, but the - * associated element imported - * @param bridge - * @return - */ - @Operation(contextual=true) - public static Element getMetaclassRef(Uml1SemanticModelBridge semanticModel) { - Element element = getElement (semanticModel); - if (element != null) { - if (element instanceof ElementImport) { - return ((ElementImport) element).getImportedElement(); - } - } - else { - System.err.println("no element found"); - } - return element; - } - - public Object createBendpoints() - { - RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); - List points = new ArrayList(2); - points.add(new RelativeBendpoint(0,0,0,0)); - points.add(new RelativeBendpoint(0,0,0,0)); - bendpoints.setPoints(points); - return bendpoints; - } -} \ No newline at end of file diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/popupactions/Di2toDiAction.java b/deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/popupactions/Di2toDiAction.java deleted file mode 100644 index 2c0729cdeda..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/popupactions/Di2toDiAction.java +++ /dev/null @@ -1,253 +0,0 @@ -/** - * @author: Manel Fredj - CEA - * This class invoke QVTO transformations that convert a diagram from di2 into di+notation - */ - -package org.eclipse.papyrus.conversion.di2todi.popupactions; - -import java.io.File; -import java.io.IOException; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.URIConverter; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.m2m.internal.qvt.oml.ast.env.ModelExtentContents; -import org.eclipse.m2m.internal.qvt.oml.common.MdaException; -import org.eclipse.m2m.internal.qvt.oml.emf.util.ModelContent; -import org.eclipse.m2m.internal.qvt.oml.library.Context; -import org.eclipse.m2m.internal.qvt.oml.runtime.generator.TransformationRunner; -import org.eclipse.m2m.internal.qvt.oml.runtime.generator.TransformationRunner.In; -import org.eclipse.m2m.internal.qvt.oml.runtime.generator.TransformationRunner.Out; -import org.eclipse.m2m.internal.qvt.oml.runtime.project.QvtInterpretedTransformation; -import org.eclipse.m2m.internal.qvt.oml.runtime.project.TransformationUtil; -import org.eclipse.m2m.internal.qvt.oml.trace.Trace; -import org.eclipse.m2m.internal.qvt.oml.trace.TraceRecord; -import org.eclipse.m2m.qvt.oml.util.IContext; -import org.eclipse.papyrus.conversion.di2.util.Di2AdapterFactory; -import org.eclipse.papyrus.conversion.di2todi.Activator; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IActionDelegate; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; - - -@SuppressWarnings("restriction") -public class Di2toDiAction implements IObjectActionDelegate { - - private static final Map options = null; - private IPath inModelPath; //reference to selected Model - private String inAbsolutepath; - - /** - * Constructor for Action1. - */ - public Di2toDiAction() { - super(); - inModelPath=null; - inAbsolutepath=null; - } - - /** - * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) - */ - public void setActivePart(IAction action, IWorkbenchPart targetPart) { - } - - /** - * @see IActionDelegate#run(IAction) - */ - public void run(IAction action) { - if (adapterFactory == null) { - // dummy operation to force loading/initialization of di2 plugin - adapterFactory = new Di2AdapterFactory(); - } - // Refer to an existing transformation via URI - final URI transformationURI = - URI.createURI("platform:/plugin/" + Activator.PLUGIN_ID + "/TransfoQvtoDi2toDi/Transfo.qvto"); - - //get the resources from the input URI - final ResourceSet resourceSet = new ResourceSetImpl(); - Job job = new Job("Convert diagram " + inModelPath.toString()) { - @Override - protected IStatus run(IProgressMonitor monitor) { - // execute the task ... - - try { - monitor.beginTask("converting ...", 4); - - URI inURI = URI.createPlatformResourceURI(inModelPath.toString(), true); - Resource inResource = resourceSet.getResource(inURI, true); - // create the inputs - List inObjects =inResource.getContents(); - ModelContent input_di2 = new ModelContent (inObjects); - ModelContent[] inputs = new ModelContent[1]; - inputs[0]=input_di2; - - // setup the execution environment details -> context - IContext mycontext = new Context(); - Trace trace= null; - - QvtInterpretedTransformation transformation = new QvtInterpretedTransformation (TransformationUtil.getQvtModule(transformationURI)); - In IntransformationRunner=new TransformationRunner.In(inputs, mycontext); - Out OuttransformationRunner=new TransformationRunner.Out(null,null, null); - - monitor.worked(1); - // running the transformation - OuttransformationRunner=transformation.run(IntransformationRunner); - - // retrieve the outputs - List outputs= OuttransformationRunner.getExtents(); - - // retrieve the trace - trace= OuttransformationRunner.getTrace(); - - if (trace !=null && outputs.size()==2) { - // processing the trace - URI Uri_trace = inURI.trimFileExtension().appendFileExtension("trace"); - EList outObjects_trace = trace.getTraceRecords(); - Resource outResource_trace = resourceSet.createResource(Uri_trace); - outResource_trace.getContents().addAll(outObjects_trace); - - // processing the outputs - ModelExtentContents output_notation = outputs.get(0); - ModelExtentContents output_di = outputs.get(1); - monitor.worked(1); - - URI Uri_notation = inURI.trimFileExtension().appendFileExtension("notation"); - URI Uri_di = inURI.trimFileExtension().appendFileExtension("di"); - - // the output objects got captured in the output extent - List outObjects_notation = output_notation.getAllRootElements(); - List outObjects_di = output_di.getAllRootElements(); - - //Let's persist them using a resource for notation - Resource outResource_notation = resourceSet.createResource(Uri_notation ); - outResource_notation.getContents().addAll(outObjects_notation); - - // let's persist them using a resource for di - Resource outResource_di = resourceSet.createResource(Uri_di); - outResource_di.getContents().addAll(outObjects_di); - - monitor.worked(1); - - try{ - outResource_notation.save(Collections.emptyMap()); - outResource_di.save(Collections.emptyMap()); - outResource_trace.save(Collections.emptyMap()); - } - catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - monitor.worked(1); - - // remove trace file - URIConverter uri= resourceSet.getURIConverter(); - uri.delete(Uri_trace, options); - } - } - catch (final MdaException e) { - Display.getDefault().syncExec(new Runnable() { - public void run() { - MessageDialog.openError( - new Shell(), "Model transformation error during conversion", e.toString ()); - } - }); - e.printStackTrace(); - } - catch (final IOException e) { - Display.getDefault().syncExec(new Runnable() { - public void run() { - MessageDialog.openError( - new Shell(), "IO error during conversion", e.toString ()); - } - }); - e.printStackTrace(); - } - catch (final RuntimeException e) { - Display.getDefault().syncExec(new Runnable() { - public void run() { - MessageDialog.openError( - new Shell(), "Error during conversion", e.toString ()); - } - }); - e.printStackTrace (); - } - finally { - // when the transformation succeeds - //1- restore the content of Di2 file i.e., di2 namespace - PapyrusNamespace.restoreDi2Namespace(inAbsolutepath); - } - - monitor.done(); - return Status.OK_STATUS; - } - }; - job.setUser (true); - job.schedule (); - } - - /** - * @see IActionDelegate#selectionChanged(IAction, ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) - { - this.inModelPath = null; - - if (!(selection instanceof IStructuredSelection)) { - // no structured-selection - return; - } - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - if (selection.isEmpty()) { - return; - } - - Object firstElement = structuredSelection.getFirstElement(); - - if (firstElement instanceof IFile) { - - IFile di2Select = (IFile) firstElement; - // retrieve the path of the file - IPath di2Path = di2Select.getFullPath(); - IPath location = di2Select.getLocation(); - if (location != null) { - // Get the file for the location - File file = location.toFile(); - if (file != null) { - // Add the absolute path to the list - this.inAbsolutepath = file.getAbsolutePath(); - } - - // check whether it is a .di2 file - String di2filename = di2Path.toString(); - if (di2filename.endsWith (".di2")) { - // change namespace of di2 - PapyrusNamespace.replaceNamespace(this.inAbsolutepath); - this.inModelPath = di2Path; - } - } - } - } - - Di2AdapterFactory adapterFactory = null; -} - diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/popupactions/PapyrusNamespace.java b/deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/popupactions/PapyrusNamespace.java deleted file mode 100644 index 5a17df64ff2..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/src/org/eclipse/papyrus/conversion/di2todi/popupactions/PapyrusNamespace.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @author: Manel Fredj - CEA - * This class enables to change the namespace of di2 metamodel from - * replace http://www.papyrusuml.org into http://www.papyrusuml.org/di2 - */ - -package org.eclipse.papyrus.conversion.di2todi.popupactions; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileWriter; -import java.io.IOException; - -public class PapyrusNamespace -{ - ///////////////////////////////////////////////////////////////////////////////////////////// - //replace http://www.papyrusuml.org -- by -- http://www.papyrusuml.org/di2 - - public static void replaceNamespace(String absolutepath) - { - try { - String oldNameSpace = "di2=\"http://www.papyrusuml.org\""; - String newNameSpace="di2=\"http://www.papyrusuml.org/di2\""; - String oldtext =readFileAsString(absolutepath); - // replace the namespace in the di2 file - String newtext = oldtext.replaceAll (oldNameSpace, newNameSpace); - - FileWriter writer = new FileWriter(absolutepath); - writer.write(newtext);writer.close(); - } - catch (IOException ioe) { - ioe.printStackTrace(); - } - } - - public static void restoreDi2Namespace(String absolutepath) - { - try { - String oldNameSpace="di2=\"http://www.papyrusuml.org/di2\""; - String newNameSpace = "di2=\"http://www.papyrusuml.org\""; - - String oldtext =readFileAsString(absolutepath); - // replace the namespace in the di2 file - String newtext = oldtext.replaceAll (oldNameSpace, newNameSpace); - - FileWriter writer = new FileWriter(absolutepath); - writer.write(newtext);writer.close(); - } - catch (IOException ioe) { - ioe.printStackTrace(); - } - } - - /** - * @param filePath the name of the file to open. Not sure if it can accept - * cccURLs or just filenames. Path handling could be better, and buffer - * sizes are hardcoded - */ - private static String readFileAsString (String filePath) - throws java.io.IOException - { - byte[] buffer = new byte[(int) new File(filePath).length()]; - BufferedInputStream f = null; - try { - f = new BufferedInputStream(new FileInputStream(filePath)); - f.read(buffer); - } - finally { - if (f != null) { - try { - f.close(); - } - catch (IOException ignored) { - } - } - } - return new String(buffer); - } -} diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/toc.xml b/deprecated/org.eclipse.papyrus.conversion.di2todi/toc.xml deleted file mode 100644 index 3057fc280ee..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/toc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/deprecated/org.eclipse.papyrus.conversion.di2todi/tocdev.xml b/deprecated/org.eclipse.papyrus.conversion.di2todi/tocdev.xml deleted file mode 100644 index 53009154565..00000000000 --- a/deprecated/org.eclipse.papyrus.conversion.di2todi/tocdev.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - -- cgit v1.2.3