How to resolve reference to ecore class? [message #1730672] |
Wed, 27 April 2016 10:36  |
Eclipse User |
|
|
|
Hi,
I'm new to both xtext and EMF and now I got stuck. I hope someone here can give me some pointers.
I want to refer to an Ecore class from within my DSL. In the end I want to be able to Ctrl-Click / F3 on that reference inside the DSL in order to navigate to its definition.
Here's what I have so far:
- An Ecore Model with a class "SomeClass" and a collection "Collection" of "SomeClass". I have a genmodel an generated all the plugins. SomeClass has a field "name" which I want to use as identifier for that instance.
- The DSL definition imports and uses the ecore model, this seems to work (no errors, warnings...)
import "http ://drei.net/toreference" as ref
...
'Reference:' ref = [ref::SomeClass]
- I added Xtext nature to the project containing the ecore and genmodel
- I added a referencedResource entry in the .mwe2 file
language = StandardLanguage {
name = "net.drei.DecDescLanguage"
referencedResource = "platform:/resource/net.drei.ToReference/model/ToReference.genmodel"
fileExtensions = "ddl"
...
}
Now when I use my DSL, I can create ".toreference" models and add instances of "SomeClass" to it. But right now I seem to be unable to refer to these classes from inside my DSL.
// I have a SomeClass named "one" in a file next to the DSL file
Reference: one
then I get the error Couldn't resolve reference to SomeClass 'one'.
My guess is that I now have to write some code which maps the name "one" to the element in the .toreference model. But where, is this a Scoping topic? Or am I missing something entirely?
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04885 seconds