|Reference ecore model elements from Xtext based DSLs [message #925315]
||Thu, 27 September 2012 15:53
| Reiner Jung
Registered: June 2010
Location: Uni Kiel
there have already been serveral posts to that topic. However, they seem not to work. I've checked:
* Joern's topic: http://www.eclipse.org/forums/index.php/m/551084/?srch=referencing+EMF+model+elements#msg_551084
* Andreas' topic: http://www.eclipse.org/forums/index.php?t=msg&th=170756&start=0&S=81127b7c17990f3eddb47e01037a6405
* Christian's blog: christiandietrich.wordpress.com /2011/07/17/xtext-2-0-and-uml/
with litte success. The primary idea is to be able to access ecore model elements in a DSL. My first idea was to implement that similar to Xtext itself with:
'package' name = QualifiedName
(metaModels += LoadMetaModel)*
'load' name=ID ePackage=[ecore::EPackage|STRING]
'probe' name=ID ':' type=[ecore::EClassifier|QualifiedName] ... ;
This did not work. When running an editor for the above DSL, and enter
load myModel "platform:/resource/MyProject/MyModel.ecore"
the editor complains about the URI (Couldn't resolve reference to EPackage). This can be reproduced with every selfmade or foreign ecore-model. An analysis of the Xtext code did not help. So I googled and came up with different solutions. First, when using
'load' name=ID importURI = STRING
The editor was able to find the model. However, I was still not able to use it in any other expression, like the Probe-rule above. I also tried the example of Christian replacing the uml specific part with an ecore specific part (which is available in org.eclipse.xtext.ecore and org.eclipse.xtext.ui.ecore, as his post implies). Still, it does not work.
My primary goal is to have a language, where I can import variuous EPackages (just like in Xtext), assign them to an alias and use the declarations in these EPackages in normal identifiers.
So if anyone has any suggestions, what I should check or fix or use, please let me know.
Powered by FUDForum
. Page generated in 0.03975 seconds