Hello. I am using xtext 2.10. I created an EMF project with library.ecore model. The model consists of Library, Book and Author. Also I created xtext project org.xtext.example.mydsl which should use this ecore model. The grammar of my language:
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate "http://www.xtext.org/example/mydsl/MyDsl"
import "platform:/resource/org.example.library/model/library.ecore" as librarymodel
import "http://www.eclipse.org/emf/2002/Ecore"
Model:
books+=MyBook*;
FullyQualifiedName:
ID ("." ID)*;
MyBook:
'book' book = [librarymodel::Book|FullyQualifiedName]
I included library.genmodel as a referencedResource in my GenerateMyDsl.mwe2 :
var rootPath = ".."
Workflow {
component = XtextGenerator {
configuration = {
project = StandardProjectConfig {
baseName = "org.xtext.example.mydsl"
rootPath = rootPath
runtimeTest = {
enabled = true
}
eclipsePlugin = {
enabled = true
}
eclipsePluginTest = {
enabled = true
}
createEclipseMetaData = true
}
code = {
encoding = "windows-1251"
fileHeader = "/*\n * generated by Xtext \${version}\n */"
}
}
language = StandardLanguage {
name = "org.xtext.example.mydsl.MyDsl"
referencedResource = "platform:/resource/org.example.library/model/library.genmodel"
fileExtensions = "mydsl"
serializer = {
generateStub = false
}
validator = {
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
}
}
}
After that I run a runtime application and create an instance of my library ecore model with several books and authors: mylibrary.library. I also created file test.mydsl and I would like to reference books from mylibrary.library. However, the content assist is empty and mylibrary-objects are not referenceable.
What am I missing? How can I reference objects of ecore-model-instances from mydsl file.
[Updated on: Tue, 19 July 2016 20:43]
Report message to a moderator