From 8018f968401e39eb3b2a03ab22391e9a22b369a0 Mon Sep 17 00:00:00 2001 From: Vincent Lorenzo Date: Mon, 23 Jan 2017 17:51:27 +0100 Subject: Bug 510869: [Importer][Rhapsody] Type are sometimes created at the root of the resource Change-Id: I221d23285e7e58730b86c9427b40e0fe570c8f4b Signed-off-by: Vincent Lorenzo --- .../Rhapsody2PapyrusSemanticElements.qvto | 25 +++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) mode change 100644 => 100755 extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusSemanticElements.qvto (limited to 'extraplugins') diff --git a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusSemanticElements.qvto b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusSemanticElements.qvto old mode 100644 new mode 100755 index 24949da83ec..0ccf09b4dc7 --- a/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusSemanticElements.qvto +++ b/extraplugins/migration/rhapsody/org.eclipse.papyrus.migration.rhapsody/transform/Rhapsody2PapyrusSemanticElements.qvto @@ -30,6 +30,8 @@ transformation Rhapsody2PapyrusSemanticElements(in inModel:umlrhapsody, out outM property events : Set(IEvent) = null; +/**This variable is used to reference the types created outside of all contexts. (bug 510869)*/ +property userTypeDeclaration: Set(Type); /** * Maunch the semantic transformation @@ -69,6 +71,13 @@ mapping umlrhapsody::IProject::iProjectToPapyrusModel() : uml::Model { }; packageImport+=importedPackages; + + if(userTypeDeclaration->notEmpty()){ + packagedElement+= object Package{ + name:="UserTypesDeclaration"; + packagedElement+=userTypeDeclaration; + } + } } /** @@ -205,19 +214,16 @@ mapping umlrhapsody::IClass::toUMLInterface() : uml::Interface when {self.oclIsT /** * -* When we match any condition, we create a uml::Class. -* If we are are, there is a bug! +* When we match any condition, we create a uml::DataType. +* We can be here in case of bug, when an existing type has not been resolved +* or when the user use the C type declaration in Rhapsody (declaring a type with a string, see bug 510869) */ -mapping umlrhapsody::IType::iTypeToDefault():uml::Class{ +mapping umlrhapsody::IType::iTypeToDefault():uml::DataType{ if(self.name=null or self.name.oclIsInvalid()){ if(self.declaration<>null){ name:=self.declaration; - log("We don't found the good type for an unamed element, with has this declaration: " + self.declaration); - }else{ - log("We don't found the good type for an unamed element"); } }else{ - log("We don't found the good type for " + self.name + " so we used the default type mapping for it"); name:=self.name.replaceAll("\"",""); }; } @@ -1003,6 +1009,7 @@ mapping umlrhapsody::IArgument::iArgumentToUMLElement(): uml::Property when {sel // should add the PtR Stereotpe if the type is a C++ Declaration : i,e: Class *; if (self.typeOf.oclIsUndefined()){ type := self.myTypeOf [IType]->any(true).oclAsType(IType).map iTypeToUMLElement().oclAsType(Type); + userTypeDeclaration+=type; }else{ type := self.typeOf [IType]->any(true).oclAsType(IType).map iTypeToUMLElement().oclAsType(Type); }; @@ -1015,6 +1022,7 @@ mapping umlrhapsody::IAttribute::iAttributeToUMLElement(): uml::Property when {s if (self.typeOf.oclIsUndefined()) { type := self.myTypeOf [IType]->any(true).oclAsType(IType).map iTypeToUMLElement().oclAsType(Type); + userTypeDeclaration+=type; }else{ type := self.typeOf [IType]->any(true).oclAsType(IType).map iTypeToUMLElement().oclAsType(Type); }; @@ -1109,7 +1117,8 @@ mapping umlrhapsody::IArgument::toArguments(): uml::Parameter // should add the PtR Stereotpe if the type is a C++ Declaration : i,e: Class *; if (self.typeOf.oclIsUndefined()) { - type := self.myTypeOf [IType]->any(true).oclAsType(IType).map iTypeToUMLElement().oclAsType(Type); + type := self.myTypeOf [IType]->any(true).oclAsType(IType).map iTypeToUMLElement().oclAsType(Type); + userTypeDeclaration+=type; }else { type := self.typeOf [IType]->any(true).oclAsType(IType).map iTypeToUMLElement().oclAsType(Type); -- cgit v1.2.3