Skip to main content



      Home
Home » Modeling » TMF (Xtext) » How to use Xtend create extensions with JavaBeansMetaModel
How to use Xtend create extensions with JavaBeansMetaModel [message #659625] Mon, 14 March 2011 16:27 Go to next message
Eclipse UserFriend
Hi.

I am using an Xtext project with the generated generator and ui projects. I suppose that the default configuration of the Xtext project uses JavaBeansMetaModel. But this seems to not work with create extensions.

Can anybody tell me how to use EMFMetaModels with Xtext?
or
can anybody tell me how to use create extensions with the JavaBeansMetaModel?
Re: How to use Xtend create extensions with JavaBeansMetaModel [message #659630 is a reply to message #659625] Mon, 14 March 2011 16:55 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

what about
component = org.eclipse.xpand2.Generator {
		metaModel = org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel {}
		expand = "templates::Template::main FOREACH greetings"
		outlet = {
			path = targetDir
		}
		fileEncoding = fileEncoding
	}


you have to adapt namespaces too.

«IMPORT myDsl»

«EXTENSION templates::Extensions»

«DEFINE main FOR Greeting-»
«FILE name+".txt"-»
This is an example of a generated file.

The input element was "Hello «name»!"

All greetings in the same file:
«FOREACH ((Model)eContainer).sortedGreetings() AS g SEPARATOR ', '»«g.name»«ENDFOREACH»
«ENDFILE-»
«ENDDEFINE»



and configure it in your generator project Xtend/Xpand properties

~Christian
Re: How to use Xtend create extensions with JavaBeansMetaModel [message #659632 is a reply to message #659625] Mon, 14 March 2011 16:57 Go to previous message
Eclipse UserFriend
Hi Olaf,

the JavaBeansMetaModel is not capable of instantiating EMF classes. But I have something in the pipeline that I for which I just added an enhancement bug and attached a solution. Use the org.eclipse.xtend.typesystem.emf.java.EMFJavaMetaModel from the attached plugin.

Kind regards,
~Karsten
Previous Topic:Validation of several models (with dependencies between them)
Next Topic:Modifying ContainerStates and its Provider
Goto Forum:
  


Current Time: Tue Jul 08 11:15:54 EDT 2025

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

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

Back to the top