[Xtext] call generator from the editor [message #676255] |
Fri, 03 June 2011 08:33  |
Eclipse User |
|
|
|
Hey
I have a DSL (DSL2) where i import the ecore model of a first DSL (DSL1)
everything works fine, i made some Xtend Templates for the generator project and as long as i start the generator project from the developement workspace it works.
Buf i need to use the generator from within the editor.
so i enabled the project wizzard (for my DSL2).
if i try to start the generator using the editor it fails with the following error message.
0 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Problems instantiating module Generator: Cannot resolve proxy: file:/C:/Dokumente%20und%20Einstellungen/becma/workspace_DSL2_prototype/gt.DSL2.generator/bin/workflow/ExperimentGenerator.mwe2#xtextLink_::0.3.4.0.1.4.1.1::0::/1
java.lang.RuntimeException: Problems instantiating module Generator: Cannot resolve proxy: file:/C:/Dokumente%20und%20Einstellungen/becma/workspace_DSL2_prototype/gt.DSL2.generator/bin/workflow/ExperimentGenerator.mwe2#xtextLink_::0.3.4.0.1.4.1.1::0::/1
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:73)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
Caused by: java.lang.IllegalStateException: Cannot resolve proxy: file:/C:/Dokumente%20und%20Einstellungen/becma/workspace_DSL2_prototype/gt.DSL2.generator/bin/workflow/ExperimentGenerator.mwe2#xtextLink_::0.3.4.0.1.4.1.1::0::/1
at org.eclipse.xtext.common.types.util.JavaReflectAccess.getRawType(JavaReflectAccess.java:88)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.create(Mwe2ExecutionEngine.java:135)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:272)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:56)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalApplyAssignments(Mwe2ExecutionEngine.java:126)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:272)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:56)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalApplyAssignments(Mwe2ExecutionEngine.java:126)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:272)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:56)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:272)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:56)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:272)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:56)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalApplyAssignments(Mwe2ExecutionEngine.java:126)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:272)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:56)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:272)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:56)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.create(Mwe2ExecutionEngine.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:71)
... 3 more
I think the dependency to the first DSL is missing somehow, but i'm not shure what to do to setthe dependency.
hope someone can help me
|
|
|
|
|
|
Re: [Xtext] call generator from the editor [message #676710 is a reply to message #676696] |
Mon, 06 June 2011 05:16  |
Eclipse User |
|
|
|
sorry, think i explain it a bit confusing
i created a Xtext project, called DSL2. in DSL2 i import a existing xtext project i already had (DSL1).
So this part works fine.
After that i used the generator project, Xtext creates for each new project, to get some generated files out of my models. Here i call my Xpand files.
Those Xpand files import a Xtend File were i link to some java code
Now i run the mwe2 workflow which Xtext already created in the generator project.
I import the two dsl i use and i call the Xpand templates, like this...
module workflow.MyGenerator
import org.eclipse.emf.mwe.utils.*
var gendataPath = "src-gen/Software/Test_Master/_gendata"
var vsProjectPath = "d:/Projekte/Test_Master/trunk/Software/modules"
var fileEncoding = "Cp1252"
var modelPath = "src/model"
Workflow {
/*===================================================================================================*/
/* Setup the generator */
/*===================================================================================================*/
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 = gt.DSL1.DSL1StandaloneSetup {}
register = gt.DSL2.DSL2StandaloneSetup {}
load = {
slot = "system"//"devices"
type = "Experiment"//"System"
}
}
/*===================================================================================================*/
/* generate all configuration files */
/*===================================================================================================*/
component = org.eclipse.xpand2.Generator {
metaModel = org.eclipse.xtend.type.impl.java.JavaBeansMetaModel {}
expand = "templates::Template_Test1::main FOREACH system"
outlet = {
path = gendataPath
}
fileEncoding = fileEncoding
}
/*then i just call all other templates like the one above*/
if i run the mwe2 workflow everything works fine.
My next step was to create a project wizzard for my DSL2 language. i did this by enabling the SimpleProjectWizardFragment and i merged the xml files. So i got the wizzard in the editor.
My problem now, if i create a DSL2 project in the DSL-Editor it get a file called Generator.mwe2 which i thought starts the generator file from the editor.
The code in the Generator.mwe2 file looks like this.
module Generator
var targetDir = "src-gen"
var modelPath = "src/model"
Workflow {
component = @workflow.DSL2Generator auto-inject {}
}
So if i run this workflow from within the editor, i get the error messages shown in the post above.
My assumption is, that i need to include something because the error message says something with a xtext link he can't resolve, but i'm not shure what i need to include because i tried a lot already. Both dsl i use seem to be alright, at least the text highlighting is working for both DSL1 and DSL2.
hope i explained my problem better, if not let me know what details you need
thanks a lot!!!
|
|
|
Powered by
FUDForum. Page generated in 0.03409 seconds