Skip to main content



      Home
Home » Modeling » TMF (Xtext) » PostProcessing(How to do post-processing since it has been deprecated)
PostProcessing [message #1784224] Fri, 23 March 2018 13:53 Go to next message
Eclipse UserFriend
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 13:56 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: PostProcessing [message #1784226 is a reply to message #1784225] Fri, 23 March 2018 14:01 Go to previous messageGo to next message
Eclipse UserFriend
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 14:02] by Moderator

Re: PostProcessing [message #1784860 is a reply to message #1784226] Wed, 04 April 2018 17:10 Go to previous messageGo to next message
Eclipse UserFriend
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 03:02 Go to previous messageGo to next message
Eclipse UserFriend
i dont undestand why you mean by "can no longer"
Re: PostProcessing [message #1784902 is a reply to message #1784880] Thu, 05 April 2018 09:26 Go to previous messageGo to next message
Eclipse UserFriend
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 09:40 Go to previous messageGo to next message
Eclipse UserFriend
please have a look at the bugzilla. it tells you what do do.
Re: PostProcessing [message #1784905 is a reply to message #1784904] Thu, 05 April 2018 09:43 Go to previous messageGo to next message
Eclipse UserFriend
here the usage in wf (in case you did not figure that out yourself)

Workflow {

component = ExtendedXtextGenerator {
postprocessor = MyXtext2EcorePostProcessor {}
Re: PostProcessing [message #1784909 is a reply to message #1784905] Thu, 05 April 2018 10:53 Go to previous message
Eclipse UserFriend
Thank you, Christian. This works.
Previous Topic:Regarding Compiler integration with Xtext
Next Topic:Removing Left Recursion
Goto Forum:
  


Current Time: Wed Jun 25 03:47:20 EDT 2025

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

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

Back to the top