Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » PostProcessing(How to do post-processing since it has been deprecated)
PostProcessing [message #1784224] Fri, 23 March 2018 17:53 Go to next message
Greg Lusk is currently offline Greg LuskFriend
Messages: 36
Registered: February 2017
Location: USA
Member
Since it looks like post processing was deprecated a while back, what is the recommended way to add model features and set initial values? Do we have to import a custom ecore model and add a node with the features that we want to add, and then inherit from the model element in the dependent grammar? Is our only other choice to use a static model instead of a generated one?
Re: PostProcessing [message #1784225 is a reply to message #1784224] Fri, 23 March 2018 17:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

about which postprocessing do you talk about?
the one for the inferred metamodel?

i think the intention of the guys who decided this was to switch to a manual metamodel.
but i also think it should be no problem to still use it.
the workaround is described at https://bugs.eclipse.org/bugs/show_bug.cgi?id=483209


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: PostProcessing [message #1784226 is a reply to message #1784225] Fri, 23 March 2018 18:01 Go to previous messageGo to next message
Greg Lusk is currently offline Greg LuskFriend
Messages: 36
Registered: February 2017
Location: USA
Member
Yes, I'm referring to the one for the inferred metamodel. I was trying to follow the example from your 2011 blog post, and came across the bug that you logged in 2015. I'll see if I can adapt the example in your blog post to 2.12 before I switch to a manual metamodel.

[Updated on: Fri, 23 March 2018 18:02]

Report message to a moderator

Re: PostProcessing [message #1784860 is a reply to message #1784226] Wed, 04 April 2018 21:10 Go to previous messageGo to next message
Greg Lusk is currently offline Greg LuskFriend
Messages: 36
Registered: February 2017
Location: USA
Member
Christian,

I am working on adapting your 2011 blog post to Xtext 2.14, but it seems that I can no longer extend the org.eclipse.xtext.generator.Generator class to create a custom generator. Can you recommend how I would substitute my custom generator in the current version?
Re: PostProcessing [message #1784880 is a reply to message #1784860] Thu, 05 April 2018 07:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
i dont undestand why you mean by "can no longer"

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: PostProcessing [message #1784902 is a reply to message #1784880] Thu, 05 April 2018 13:26 Go to previous messageGo to next message
Greg Lusk is currently offline Greg LuskFriend
Messages: 36
Registered: February 2017
Location: USA
Member
In your original blog post, you created a class called ExtendedGenerator that inherits from org.eclipse.xtext.generator.Generator. But it seems that org.eclipse.xtext.generator.Generator does not exist any more in that package. So would I inherit from XtextGenerator instead, like so?

import org.eclipse.xtext.xtext.generator.XtextGenerator;
import org.eclipse.xtext.XtextRuntimeModule;
import org.eclipse.xtext.XtextStandaloneSetup;
import org.eclipse.xtext.xtext.ecoreInference.IXtext2EcorePostProcessor;
 
import com.google.inject.Guice;
import com.google.inject.Injector;
public class ExtendedGenerator extends XtextGenerator {
	  public ExtendedGenerator() {
	        new XtextStandaloneSetup() {
	            @Override
	            public Injector createInjector() {
	                return Guice.createInjector(new XtextRuntimeModule() {
	                   
	                    @SuppressWarnings("unused")
						public Class<? extends IXtext2EcorePostProcessor> bindEcorePostProcessor() {
	                        return StructuredTextEcorePostProcessor.class;
	                    }
	                });
	            }
	        }.createInjectorAndDoEMFRegistration();
	    }
}


Or do I even need to create the ExtendedGenerator class, since I can just specify the binding for my custom EcorePostProcessor in my language's Module class like so:
def Class<? extends IXtext2EcorePostProcessor> bindEcorePostProcessor(){
		return StructuredTextEcorePostProcessor
	}
Re: PostProcessing [message #1784904 is a reply to message #1784902] Thu, 05 April 2018 13:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
please have a look at the bugzilla. it tells you what do do.

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: PostProcessing [message #1784905 is a reply to message #1784904] Thu, 05 April 2018 13:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
here the usage in wf (in case you did not figure that out yourself)

Workflow {

component = ExtendedXtextGenerator {
postprocessor = MyXtext2EcorePostProcessor {}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: PostProcessing [message #1784909 is a reply to message #1784905] Thu, 05 April 2018 14:53 Go to previous message
Greg Lusk is currently offline Greg LuskFriend
Messages: 36
Registered: February 2017
Location: USA
Member
Thank you, Christian. This works.
Previous Topic:Regarding Compiler integration with Xtext
Next Topic:Removing Left Recursion
Goto Forum:
  


Current Time: Thu Apr 18 03:48:42 GMT 2024

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

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

Back to the top