Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Using xpand with xtext
Using xpand with xtext [message #894824] Tue, 10 July 2012 16:28 Go to next message
Martin Girschick is currently offline Martin GirschickFriend
Messages: 10
Registered: July 2009
Junior Member
I'm quite sure that this is a commonly asked question but I simply didn't find any answers :-/.

I'm trying to migrate a very old oAW project to Juno/Xtext2. We previously used xpand scripts to create output text, but I'm somehow unable migrate the old oaw workflows to mwe2 or something else, which works.

All examples for xpand seem to take .xmi-files as input. Is there an example somewhere, which shows how xtext created parsers/metamodels/models are wired to an xpand based generation process? I guess I need to add specific generated java classes to my workflow definition, is that correct?

Sorry for not being able to describe it more precisly...

Martin
Re: Using xpand with xtext [message #894826 is a reply to message #894824] Tue, 10 July 2012 16:48 Go to previous messageGo to next message
Martin Girschick is currently offline Martin GirschickFriend
Messages: 10
Registered: July 2009
Junior Member
I've managed to get one step further. I've now created a mwe2-workflow which uses org.eclipse.xtext.mwe.Reader. So I think and hope my initial problem is solved, I'll post again, if something comes up Smile.
Re: Using xpand with xtext [message #894833 is a reply to message #894826] Tue, 10 July 2012 17:06 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

the only problem is how to configure the reader this highly depends on how you want to generate and how your metamodel/dsl looks like.
here an example for the greeting example

module org.xtext.example.mydsl.generator.MyDslGeneratorMWE

import org.eclipse.emf.mwe.utils.*

var targetDir = "src-gen"
var modelPath = "model"

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 = org.xtext.example.mydsl.MyDslStandaloneSetup {}
		load = {
			type = "Greeting"
			slot = "greetings"
		}
	}
	
	component = org.eclipse.xpand2.Generator {
		expand = "org::xtext::example::mydsl::generator::Main::main FOREACH greetings"
		outlet = {
			path = targetDir
		}
	}


}


~Christian

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:How to add labels to outline view
Next Topic:Package declaration
Goto Forum:
  


Current Time: Fri Apr 19 22:02:28 GMT 2024

Powered by FUDForum. Page generated in 0.03184 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top