|
Re: XBase EMF [message #1842249 is a reply to message #1842239] |
Mon, 14 June 2021 12:46 |
|
hi did you add a referenceResource="platform:/resource//org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel" to the language section ?
if this does not help, can you provide a complete reproducible example?
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
Re: XBase EMF [message #1842251 is a reply to message #1842250] |
Mon, 14 June 2021 14:16 |
|
in you grammar you have
JavaStatement returns JavaStatement:
name+=XExpression (name+=XExpression)*
;
but in metamodel conainment=false.
with consistent use of platform:/resource in ecore and genmodel
it works fine for me
From 26506b4209ab80cf0f27fce2748ff649386930eb Mon Sep 17 00:00:00 2001
From: Christian Dietrich <christian.dietrich@itemis.de>
Date: Mon, 14 Jun 2021 16:14:38 +0200
Subject: [PATCH] fix problem
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
---
.../model/cbcmodel.ecore | 4 ++--
.../model/cbcmodel.genmodel | 19 +++++++++----------
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/de.tu-bs.cs.isf.cbc.model/model/cbcmodel.ecore b/de.tu-bs.cs.isf.cbc.model/model/cbcmodel.ecore
index 59d5caf..f48f6eb 100644
--- a/de.tu-bs.cs.isf.cbc.model/model/cbcmodel.ecore
+++ b/de.tu-bs.cs.isf.cbc.model/model/cbcmodel.ecore
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-referenceResource="platform:/resource//org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="cbcmodel" nsURI="http://www.example.org/cbcmodel" nsPrefix="cbcmodel">
<eClassifiers xsi:type="ecore:EClass" name="CbCFormula">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
@@ -39,7 +38,8 @@ referenceResource="platform:/resource//org.eclipse.xtext.common.types/model/Java
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="SkipStatement" eSuperTypes="#//AbstractStatement"/>
<eClassifiers xsi:type="ecore:EClass" name="JavaStatement">
- <eStructuralFeatures xsi:type="ecore:EReference" name="name" upperBound="-1" eType="ecore:EClass http://www.eclipse.org/xtext/xbase/Xbase#//XExpression"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="name" upperBound="-1" eType="ecore:EClass ../../org.eclipse.xtext.xbase/model/Xbase.ecore#//XExpression"
+ containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="postCondition" eType="#//Condition"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="preCondition" eType="#//Condition"
diff --git a/de.tu-bs.cs.isf.cbc.model/model/cbcmodel.genmodel b/de.tu-bs.cs.isf.cbc.model/model/cbcmodel.genmodel
index 7532928..3236146 100644
--- a/de.tu-bs.cs.isf.cbc.model/model/cbcmodel.genmodel
+++ b/de.tu-bs.cs.isf.cbc.model/model/cbcmodel.genmodel
@@ -2,10 +2,10 @@
<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/de.tu-bs.cs.isf.cbc.model/src-gen" editDirectory="/de.tu-bs.cs.isf.cbc.model.edit/src-gen"
editorDirectory="/de.tu-bs.cs.isf.cbc.model.editor/src-gen" modelPluginID="de.tu-bs.cs.isf.cbc.model"
- referenceResource="platform:/resource//org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel"
forceOverwrite="true" modelName="Cbcmodel" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
testsDirectory="/de.tu-bs.cs.isf.cbc.model.tests/src-gen" importerID="org.eclipse.emf.importer.ecore"
- complianceLevel="8.0" copyrightFields="false" operationReflection="true" importOrganizing="true">
+ complianceLevel="8.0" copyrightFields="false" usedGenPackages="platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel#//xbase platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel#//types"
+ operationReflection="true" importOrganizing="true">
<foreignModel>cbcmodel.ecore</foreignModel>
<genPackages prefix="Cbcmodel" basePackage="de.tu_bs.cs.isf.cbc" disposableProviderFactory="true"
ecorePackage="cbcmodel.ecore#/">
@@ -44,21 +44,21 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute cbcmodel.ecore#//AbstractStatement/comment"/>
</genClasses>
<genClasses ecoreClass="cbcmodel.ecore#//SkipStatement"/>
- <genClasses ecoreClass="cbcmodel.ecore#//JMLAnnotation">
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cbcmodel.ecore#//JMLAnnotation/requires"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cbcmodel.ecore#//JMLAnnotation/assignable"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cbcmodel.ecore#//JMLAnnotation/ensures"/>
- </genClasses>
<genClasses ecoreClass="cbcmodel.ecore#//JavaStatement">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute cbcmodel.ecore#//JavaStatement/name"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EReference cbcmodel.ecore#//JavaStatement/name"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cbcmodel.ecore#//JavaStatement/postCondition"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cbcmodel.ecore#//JavaStatement/preCondition"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute cbcmodel.ecore#//JavaStatement/proven"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute cbcmodel.ecore#//JavaStatement/comment"/>
</genClasses>
+ <genClasses ecoreClass="cbcmodel.ecore#//JMLAnnotation">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute cbcmodel.ecore#//JMLAnnotation/requires"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute cbcmodel.ecore#//JMLAnnotation/assignable"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute cbcmodel.ecore#//JMLAnnotation/ensures"/>
+ </genClasses>
<genClasses ecoreClass="cbcmodel.ecore#//BlockStatement">
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cbcmodel.ecore#//BlockStatement/jmlAnnotation"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cbcmodel.ecore#//BlockStatement/javaStatement"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cbcmodel.ecore#//BlockStatement/jmlAnnotation"/>
</genClasses>
<genClasses ecoreClass="cbcmodel.ecore#//CompositionStatement">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cbcmodel.ecore#//CompositionStatement/firstStatement"/>
@@ -135,7 +135,6 @@
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cbcmodel.ecore#//StrengthWeakStatement/weakPreCondition"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cbcmodel.ecore#//StrengthWeakStatement/strongPostCondition"/>
</genClasses>
-
<genClasses ecoreClass="cbcmodel.ecore#//MethodRefinements">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference cbcmodel.ecore#//MethodRefinements/productvariants"/>
</genClasses>
--
2.30.1 (Apple Git-130)
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Re: XBase EMF [message #1842274 is a reply to message #1842272] |
Tue, 15 June 2021 08:41 |
|
if you use xbase the generator that will be used is JvmModelGenerator
so if you want to customize it you need to subclass it
and override org.eclipse.xtext.xbase.DefaultXbaseRuntimeModule.bindIGenerator()
in youe runtime module.
but the usual way is to do all in the inferrer and not to touch JvmModelGenerator
so i wonder what your exact usecase is
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04353 seconds