Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xtext] call generator from the editor
[Xtext] call generator from the editor [message #676255] Fri, 03 June 2011 08:33 Go to next message
Matthias B. is currently offline Matthias B.
Messages: 9
Registered: April 2011
Junior Member
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 #676344 is a reply to message #676255] Fri, 03 June 2011 15:55 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven Efftinge
Messages: 1759
Registered: July 2009
Senior Member
Hi Matthias,

Am 6/3/11 2:33 PM, schrieb Matthias B.:
> 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.

Are you using Xtend2?

>
> Buf i need to use the generator from within the editor.
> so i enabled the project wizzard (for my DSL2).

What project wizard did you enable?

>
> if i try to start the generator using the editor it fails with the
> following error message.

You cannot use MWE2 from within your editor. Thee is still an open
issue. But usualyy you don't need it? What is the mwe2 file doing?


Sven

--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [Xtext] call generator from the editor [message #676689 is a reply to message #676344] Mon, 06 June 2011 03:23 Go to previous messageGo to next message
Matthias B. is currently offline Matthias B.
Messages: 9
Registered: April 2011
Junior Member
hey, sorry for the lait reply!

> Are you using Xtend2?
no, i don't use xtend2 at the moment

> What project wizard did you enable?
i enabled the wizard they already have in the xtext workflow of my langage

// project wizard (optional) 
			fragment = projectWizard.SimpleProjectWizardFragment {
				generatorProjectName = "${projectName}.generator" 
				modelFileExtension = file.extensions
			}


> You cannot use MWE2 from within your editor. Thee is still an open
> issue. But usualyy you don't need it? What is the mwe2 file doing?

i read my model (both the first and the second one)

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.Asap2StandaloneSetup {} 
		register = gt.DSL2.ExperimentStandaloneSetup {}
		load = {
			slot = "system"//"devices"
			type = "Experiment"//"System"
		}
	}


and i start the Xpand Templates like this:

component = org.eclipse.xpand2.Generator {
		metaModel = org.eclipse.xtend.type.impl.java.JavaBeansMetaModel {}
		expand = "templates::Template_TestCode::main FOREACH system"
		outlet = {
		path = gendataPath
		}
		fileEncoding = fileEncoding
	}


Re: [Xtext] call generator from the editor [message #676696 is a reply to message #676689] Mon, 06 June 2011 04:18 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven Efftinge
Messages: 1759
Registered: July 2009
Senior Member
Sorry, I don't understand what your problem is.
What has the SimpleProjectWizardFragment to do with the other workflow
you mentioned?
Can you share more details?

Sven


Am 6/6/11 9:23 AM, schrieb Matthias B.:
> hey, sorry for the lait reply!
>
>> Are you using Xtend2?
> no, i don't use xtend2 at the moment
>
>> What project wizard did you enable?
> i enabled the wizard they already have in the xtext workflow of my langage
>
> // project wizard (optional) fragment =
> projectWizard.SimpleProjectWizardFragment {
> generatorProjectName = "${projectName}.generator"
> modelFileExtension = file.extensions
> }
>
>> You cannot use MWE2 from within your editor. Thee is still an open
>> issue. But usualyy you don't need it? What is the mwe2 file doing?
>
> i read my model (both the first and the second one)
>
> 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.Asap2StandaloneSetup {} register =
> gt.DSL2.ExperimentStandaloneSetup {}
> load = {
> slot = "system"//"devices"
> type = "Experiment"//"System"
> }
> }
>
> and i start the Xpand Templates like this:
>
> component = org.eclipse.xpand2.Generator {
> metaModel = org.eclipse.xtend.type.impl.java.JavaBeansMetaModel {}
> expand = "templates::Template_TestCode::main FOREACH system"
> outlet = {
> path = gendataPath
> }
> fileEncoding = fileEncoding
> }
>
>


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [Xtext] call generator from the editor [message #676710 is a reply to message #676696] Mon, 06 June 2011 05:16 Go to previous message
Matthias B. is currently offline 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!!!
Previous Topic:[xtend2][ecore] Can I generate from ecore models using Xtend2?
Next Topic:[Acceleo] Class Cast Exception with UML Profiles
Goto Forum:
  


Current Time: Wed Jul 30 05:20:57 EDT 2014

Powered by FUDForum. Page generated in 0.02141 seconds