Home » Modeling » Epsilon » [SOLVED][EUGENIA] generate EMFText model
[SOLVED][EUGENIA] generate EMFText model [message #1110766] |
Tue, 17 September 2013 09:57 |
Xabier De Carlos Messages: 12 Registered: September 2013 |
Junior Member |
|
|
Hi,
I am analysing how to generate an EMFText syntax model in a similar way that GMF models are generated with Eugenia. For this purpose I have created an EOL file and ECore2EMFTextDelegate.java where EOL file is specified and ECore, Genmodel and EMFText models are loaded.
For testing, I have also created a run configuration that loads same models and executes eol file. This run configuration generates successfully the syntax model. The content of the file is the following:
SYNTAXDEF system
FOR <http:es.ikerlan/system>
START System
OPTIONS {
reloadGeneratorModel = "true";
}
But the problem comes when the eol is executed in a second Eclipse instance (I have added the GeneratedEMFTExtDelegate to a extended "org.eclipse.epsilon.eugenia" plugin, adding new actions, etc.). The syntax model is generated but the file is not correct:
SYNTAXDEF system
FOR <//system>
START System
OPTIONS {
reloadGeneratorModel = "true";
}
The problem is that instead of namespace URI //system appears, and I don't find the reason. The contents of my GenerateEMFTextDelegate are:
...
@Override
public String getBuiltinTransformation() {
return "transformations/ECore2EMFText.eol";
}
@Override
public String getCustomizationTransformation() {
return "ECore2EMFText.eol";
}
@Override
public EugeniaActionDelegateStep getStep() {
return EugeniaActionDelegateStep.emftext;
}
@Override
public List<IModel> getModels() throws Exception {
List<IModel> models = new ArrayList<IModel>();
models.add(loadModel("ECore", gmfFileSet.getEcorePath(), EcorePackage.eINSTANCE.getNsURI(), true, false, false));
models.add(loadModel("GenModel", gmfFileSet.getGenModelPath(), GenModelPackage.eINSTANCE.getNsURI(), true, false, true));
models.add( loadModel("EMFText", gmfFileSet.getEMFTextPath(), ConcretesyntaxPackage.eINSTANCE.getNsURI() , false, true, true));
return models;
}
@Override
public String getTitle() {
return "Generating EMFText model";
}
...
This can be an error of cross references between ECore and Genmodel models? How can I resolve it?
Thank you for your attention!
[Updated on: Sun, 22 September 2013 21:44] Report message to a moderator
|
|
| |
Re: [EUGENIA] generate EMFText model [message #1111573 is a reply to message #1111023] |
Wed, 18 September 2013 12:04 |
Xabier De Carlos Messages: 12 Registered: September 2013 |
Junior Member |
|
|
Hi Dimitris,
The version of Epsilon that I'm using is the last interim version (1.1.0).
In this post I have attached two eclipse projects:
es.ikerlan.generateEMFText: a plugin that contains basically source code of eugenia (delegates that are not needed are not included) and a new delegate for generating EMFText models (GenerateEMFTextDelegate.java). This one executes ECore2EMFText.eol file (in transformations folder) and generates an EMFText model from ecore and genmodel models.
This project is executed within a second instance of eclipse and adds a new action in the contextual menu that appears right clicking an ecore model.
example: a EMF plugin where the models are specified. This plugin should be imported in the workspace of the second eclipse instance.
Reproducing the error:
If GenerateEMFText.launch is executed (in transformations folder of es.ikerlan.generateEMFText), the EMFText model is generated in models folder. Even if the .cs model is incomplete, the generated part is valid:
SYNTAXDEF system
FOR <http//es.ikerlan/system>
START System
OPTIONS {
reloadGeneratorModel = "true";
}
RULES {
}
Then, a second instance of eclipse is executed, running also es.ikerlan.generateEMFText plugin. After importing example project to the second instance's workspace, make a right click over model.ecore selecting Generate EMFText model (CS) from the contextual menu. The generation is executed creating model.cs in same folder. Generated model is not correct: //system appears instead of http//es.ikerlan/system
SYNTAXDEF system
FOR <//system>
START System
OPTIONS {
reloadGeneratorModel = "true";
}
RULES {
}
As the generation is successfull using a launch configuration, seems that the error is caused by the code of es.ikerlan.generateEMFText plugin, but I don't find where.
Thanks,
Xabi.
[Updated on: Wed, 18 September 2013 12:07] Report message to a moderator
|
|
|
Re: [EUGENIA] generate EMFText model [message #1114367 is a reply to message #1111573] |
Sun, 22 September 2013 16:34 |
|
Hi Xabi,
For some reason, the order in which you load the models seems to be important (!!!). I suspect that this has to do something with the way EMFText handles URIs (if you save your .cs model as XMI and open it with a text editor you should notice some non-standard URIs). In any case, reordering your models in GenerateEMFTextDelegate so that they are loaded in the same order as your launch configuration seems to be doing the trick:
models.add(loadModel("EMFText", gmfFileSet.getEMFTextPath(), ConcretesyntaxPackage.eINSTANCE.getNsURI() , false, true, false));
models.add(loadModel("GenModel", gmfFileSet.getGenModelPath(), GenModelPackage.eINSTANCE.getNsURI(), true, false, true));
models.add(loadModel("ECore", gmfFileSet.getEcorePath(), EcorePackage.eINSTANCE.getNsURI(), true, false, false));
Cheers,
Dimitris
[Updated on: Sun, 22 September 2013 16:35] Report message to a moderator
|
|
| |
Goto Forum:
Current Time: Thu Apr 25 11:52:24 GMT 2024
Powered by FUDForum. Page generated in 0.03041 seconds
|