Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/customization/org.eclipse.papyrus.customization.properties.generation/transforms/ecore2datacontext.qvto')
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties.generation/transforms/ecore2datacontext.qvto26
1 files changed, 24 insertions, 2 deletions
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties.generation/transforms/ecore2datacontext.qvto b/plugins/customization/org.eclipse.papyrus.customization.properties.generation/transforms/ecore2datacontext.qvto
index 4d2edc29468..92424c563ef 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties.generation/transforms/ecore2datacontext.qvto
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties.generation/transforms/ecore2datacontext.qvto
@@ -10,7 +10,9 @@ main() {
ecore.rootObjects()[EPackage]->map toContext();
}
-mapping EPackage::toContext() : c: Context, root:DataContextRoot{
+mapping EPackage::toContext() : c: Context, root:DataContextRoot when {
+ self.isMainPackage() //Only transform source EPackages ; not their dependencies
+}{
c.name := self.name;
c.dataContexts := root;
c.views := self.eClassifiers->select(e | e.oclIsKindOf(EClass))->map toDataContextElement().viewSingle
@@ -53,7 +55,10 @@ abstract mapping EClassifier::toDataContextElement() : element : DataContextElem
element.name := self.name;
}
-mapping EClass::toDataContextElement() : element : DataContextElement, viewSingle : View, viewMultiple : View inherits EClassifier::toDataContextElement{
+mapping EClass::toDataContextElement() : element : DataContextElement, viewSingle : View, viewMultiple : View inherits EClassifier::toDataContextElement
+when {
+ self.ePackage.isMainPackage() //Only transform Classifiers from source EPackages ; not their dependencies
+}{
element.properties := self.eStructuralFeatures->map toProperty();
element.supertypes := self.eSuperTypes.map toDataContextElement().element;
@@ -72,6 +77,18 @@ mapping EClass::toDataContextElement() : element : DataContextElement, viewSingl
viewMultiple.context := self.getContext();
}
+query EPackage::isMainPackage() : Boolean {
+ return if ecore.rootObjects()->includes(self) then
+ true
+ else
+ if self.eSuperPackage.oclIsUndefined() then
+ false
+ else
+ self.eSuperPackage.isMainPackage()
+ endif
+ endif;
+}
+
mapping EClass::toConstraint(view : View) : SimpleConstraint {
name := "is" + view.name.replace(' ', '');
display := view;
@@ -91,9 +108,14 @@ mapping EStructuralFeature::toProperty() : Property {
name := self.name;
type := self.eType.toType();
multiplicity := if self.upperBound = 1 then 1 else -1 endif;
+ description := self.getGenModelDocumentation();
//multiplicity := self.upperBound;
}
+query EModelElement::getGenModelDocumentation() : String {
+ return self.eAnnotations->select(e | e.source = 'http://www.eclipse.org/emf/2002/GenModel').details->any(entry | entry.key = 'documentation').value;
+}
+
query EClassifier::toType() : Type {
log("Unknown type : "+self.repr());
return null;

Back to the top