|
|
|
|
Re: [Xtext] call generator from the editor [message #676710 is a reply to message #676696] |
Mon, 06 June 2011 09:16  |
Matthias B. Messages: 9 Registered: April 2011 |
Junior Member |
|
|
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.02201 seconds