Xtext project from an existing ecore model : generation impossible [message #547792] |
Mon, 19 July 2010 11:54  |
Eclipse User |
|
|
|
Hello,
I already talked about this error in an other topic. But the topic begin to be big and we talked about many errors. So i decided to create this new topic to isolate this error.
I have really no idea to solve this problem.
In fact, every time I create a project from a existing xtext project from an ecore model, I have this errors.
when I do that I can make my own language and generate this langage.
I can then write a new file (foo.myDsl for example) with ma language syntaxe. until here, no problem.
But xtext want to read read foo.myDsl, it doesn't work.
I have this exception :
Caused by: org.eclipse.emf.mwe.core.WorkflowInterruptedException: Validation problems:
1 error:
foo.myDsl - /Users/jguidoux/workspace/fr.irisa.cairn.graphAdapterDSL.generator/src/model/foo.myDsl
2: An object may not circularly contain itself
I don't see any cycle possible in my model.
I will now explain you all the manipulation I have done.
1) I create a EMF project
2) create a ecore File (fooModel.ecore)
3) create a package (fooPackage)
4) create a class (CompilationUnit)
5) add a EString attribute to this class (called packageDeclaration)
6) create a genModel file from the ecore file
7) generate the model Code
create a new xtext from this ecore file
9) mofify the xtext file : he lookd like that :
[CODE][
Model returns CompilationUnitit :
'package:' adapted_Package=EString
;
EString returns ecore::EString:
STRING | ID;
/CODE]
10) run the .mwe2 file to generate the language
11) run a new eclipse wokench and create a new file (foo.myDsl)
12) write this the the file foo.myDsl :
13) place foo.myDsl ine the model pckage of the .generator project.
14) modify the .mwe2 file of the .generator project like this :
Workflow {
component = org.eclipse.xtext.mwe.Reader {
// lookup all resources on the classpath
// useJavaClassPath = true
// or define search scope explicitly
path = modelPath
// this class will be generated by the xtext generator
register = fr.irisa.cairn.graphAdapter.LanguageStandaloneSetup {}
load = {
slot = "compilationUnits"
type = "CompilationUnit"
}
}
component = org.eclipse.xpand2.Generator {
expand = "templates::Template::main FOREACH compilationUnits"
outlet = {
path = targetDir
}
fileEncoding = fileEncoding
}
}
15) modify the MyDslStandAloneSetup class like this :
@Override
public void register(final Injector injector) {
EPackage.Registry.INSTANCE.put(FooPackage.eINSTANCE.getNsURI(),FooPackage.eINSTANCE);
}
16) modify the file Template.txt like this :
«IMPORT fooPackager»
«DEFINE main FOR CompilationUnit-»
«ENDDEFINE»
17) and finally run the .mwe2 file of the generator project. but at this time, I hace this exception :
Caused by: org.eclipse.emf.mwe.core.WorkflowInterruptedException: Validation problems:
1 error:
foo.myDsl - /Users/jguidoux/workspace/fr.irisa.cairn.graphAdapterDSL.generator/src/model/foo.myDsl
2: An object may not circularly contain itself
I have this exception since more 1 weeks. And I really don't know why. As you can see, this exemple is very simple. There are no cycle in the foo.ecore file or in the foo.myDsl file.
Am I the one to have tis exception?
I searched on internet I can see this exception no where.
Does anyone has already created an xtext project from an ecore file with xtext 1.0? if yes, did it works?
Does anyone can see my mistaks?
Is it a bug from xtext?
Sorry for this long topic. but I tried to write a topi which well explain my problem with my poor english language.
Jérémie
[Updated on: Mon, 19 July 2010 11:55] by Moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.20355 seconds