Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 20:27 Go to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
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 20:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
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


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to use Xtend create extensions with JavaBeansMetaModel [message #659632 is a reply to message #659625] Mon, 14 March 2011 20:57 Go to previous message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

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


Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Previous Topic:Validation of several models (with dependencies between them)
Next Topic:Modifying ContainerStates and its Provider
Goto Forum:
  


Current Time: Fri Apr 19 09:29:45 GMT 2024

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

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

Back to the top