blob: 03b27464e956e2e82a9c33183f2ea551d535e7f9 [file] [log] [blame]
/*****************************************************************************
* Copyright (c) 2016 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:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
*****************************************************************************/
import Rpy2PapyrusSemanticElements;
import RpyUtils;
import SysMLRpyUtils;
import SysML11ParametricDiagram;
import SysML11BlockDefinitionDiagram;
import SysML11InternalBlockDiagram;
import org.eclipse.papyrus.interoperability.rpy.blackboxes.Rpy2PapyrusNotationBlackboxes;
modeltype umlrpy "strict" uses 'http://www.eclipse.org/Papyrus/UMLRpy/1.0.0';
modeltype notation "strict" uses 'http://www.eclipse.org/gmf/runtime/1.0.2/notation';
modeltype uml "strict" uses 'http://www.eclipse.org/uml2/5.0.0/UML';
modeltype sysml11 "strict" uses 'http://www.eclipse.org/papyrus/0.7.0/SysML';
modeltype ecore "strict" uses 'http://www.eclipse.org/emf/2002/Ecore';
modeltype UMLPrimitivesTypes "strict" uses 'http://www.eclipse.org/uml2/5.0.0/Types' ;
modeltype properties "strict" uses 'http://www.eclipse.org/papyrus/internationalization/model';
/**
*
* This transformation does the SysML 1.1 Diagram creation from a Rpy Model
*
*/
transformation SysML11Diagrams(in semantics : umlrpy, out graphics : notation, inout model:uml,in Sysml11Profile:sysml11, in primitives:UMLPrimitivesTypes, inout labels:properties)
access transformation Rpy2PapyrusSemanticElements(in inModel:umlrpy, out outModel:uml, in primitives:UMLPrimitivesTypes)
extends Rpy2PapyrusSemanticElements(in inModel:umlrpy, out outModel:uml, in primitives:UMLPrimitivesTypes)
{
main() {
if(sysml11<>null){
if(isContainingSysMLRpyStereotypeReference(semantics.objectsOfKind(EObject))){
log("SysML Diagrams Mapping");
var diagrams:Set(IDiagram):= semantics.objects()[IDiagram];
var iProject:Set(IProject):=semantics.rootObjects()[IProject];
diagrams->map iDiagramToPapyrusSysML11Diagram(iProject->any(true));//we assume that there is only one IProject in the model
//managing internationalization (labels of SysML Rhaposdy Diagrams)
var internationalizationLibrary:InternationalizationLibrary:=labels.rootObjects()->selectByKind(InternationalizationLibrary)->any(true);
if(internationalizationLibrary.oclIsUndefined()){
internationalizationLibrary:= object InternationalizationLibrary@labels{}
};
diagrams->forEach(current){
var res:Diagram:= current.resolveoneIn(rpymetamodel::IDiagram::iDiagramToPapyrusSysML11Diagram);
if(res<>null and not current.displayName.oclIsUndefined() and current.displayName.size()<>0){
internationalizationLibrary.entries+= object InternationalizationEntry{
key:=res;
value:=current.displayName;
}
}
};
log("End of SysML Diagram Mapping");
}else{
log("There is not SysML Stereotype applied on the Rpy model.");
};
}
}
}
/**
*
* This method do the mapping between Rpy SysML Diagram and Papyrus SysML11 Diagram
*/
mapping rpymetamodel::IDiagram::iDiagramToPapyrusSysML11Diagram(rpyProject:IProject):Diagram@graphics disjuncts
rpymetamodel::IDiagram::iDiagramToSysML11BlockDefinitionDiagram,
rpymetamodel::IDiagram::iDiagramToSysML11InternalBlockDiagram,
rpymetamodel::IDiagram::iDiagramToSysML11ParametricDiagram
{}