Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to use text generators and JvmInferrer in one project ?(I have am model from which I want to generate plain text files and java classes using the JvmModelInferrer)
How to use text generators and JvmInferrer in one project ? [message #1739819] Thu, 04 August 2016 18:04 Go to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
How can I create an Xtext project that uses text generators and jvmModelInferrers at the same time?
Re: How to use text generators and JvmInferrer in one project ? [message #1739820 is a reply to message #1739819] Thu, 04 August 2016 18:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14736
Registered: July 2009
Senior Member
jvm model inferrer uses a text generator (the class is JvmModelgenerator) so subclass, bind and go

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: How to use text generators and JvmInferrer in one project ? [message #1739829 is a reply to message #1739820] Thu, 04 August 2016 19:30 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
Christian Dietrich wrote on Thu, 04 August 2016 14:15
jvm model inferrer uses a text generator (the class is JvmModelgenerator) so subclass, bind and go

Thank you for the answer. Remaining two questions:

1. Which method to override ?
2. Why the use of JvmModelGenerator is discouraged ?
Re: How to use text generators and JvmInferrer in one project ? [message #1739831 is a reply to message #1739829] Thu, 04 August 2016 19:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14736
Registered: July 2009
Senior Member
(1) org.eclipse.xtext.xbase.compiler.JvmModelGenerator.doGenerate(Resource, IFileSystemAccess)
(2) cause eclipse people compain if api changes. thus the api is is restricted. if you can live with having to adapt your impl in a future version of xtext that is ok isnt it?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: How to use text generators and JvmInferrer in one project ? [message #1739832 is a reply to message #1739831] Thu, 04 August 2016 20:00 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
Christian Dietrich wrote on Thu, 04 August 2016 15:35
(1) org.eclipse.xtext.xbase.compiler.JvmModelGenerator.doGenerate(Resource, IFileSystemAccess)

Ho do I get the IJvmDeclaredTypeAcceptor object to use the comfort of JvmInferrer ?
Can I inject it via the injection framework ?
The constructor takes a DerivedStateAwareResource. How can I get this ?
How can I bind the acceptor to the given IFileSystemAccess ?

Quote:

(2) cause eclipse people compain if api changes. thus the api is is restricted. if you can live with having to adapt your impl in a future version of xtext that is ok isnt it?

Thats Ok, although I would prefere a stable API for using JvmInferrer and TextGenerator together in one project.
I think projects usually consist of java and text files so it is a common use case to generate both types from one project, isn't it.
Re: How to use text generators and JvmInferrer in one project ? [message #1739848 is a reply to message #1739832] Fri, 05 August 2016 04:00 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14736
Registered: July 2009
Senior Member
You don't. These are completely different things running at different phases.
If you want to infer classes with the jvmdeclaredtypeacceptor then do it in the inferrer
If you want to generate pure text do it in the generator.

Maybe you can elaborate on your usecase. What kind of Java classes do you want to generate without inferrer but using jv,declaredtypeacceptor


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Previous Topic:XBase: Adding explicit import statement using JvmModelInferrer
Next Topic:Out Of Memory Error
Goto Forum:
  


Current Time: Thu Dec 12 20:36:01 GMT 2024

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

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

Back to the top