Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Using IContextualOutputConfigurationProvider(Using IContextualOutputConfigurationProvider instead of IOutputConfigurationProvider)
Using IContextualOutputConfigurationProvider [message #1782998] Tue, 06 March 2018 05:24 Go to next message
Eclipse UserFriend
I have a project where I want to set the output directories according to information available using import org.eclipse.emf.ecore.resource.Resource.

Since the OutputConfigurationProvider uses the Set<OutputConfiguration> getOutputConfigurations() from IOutputConfigurationProvider, which has no Resource context argument, so I decided to try and use the Set<OutputConfiguration> getOutputConfigurations(Resource input) available at IContextualOutputConfigurationProvider but for some reason the last one never gets called.

I modified the RuntimeModule by adding
def Class<? extends IContextualOutputConfigurationProvider> bindIContextualOutputConfigurationProvider() {
MyOutputConfigurationProvider
}

and used on the OutputConfigurationProvider,
class MyOutputConfigurationProvider implements IContextualOutputConfigurationProvider {

instead of

class MyOutputConfigurationProvider implements IOutputConfigurationProvider {

Any hints on what else should I modify to be able to use the IContextual?

Cheers!





Re: Using IContextualOutputConfigurationProvider [message #1783181 is a reply to message #1782998] Thu, 08 March 2018 15:54 Go to previous messageGo to next message
Eclipse UserFriend
can you be more specific on "where" your problem occurs?
which client api do you use that accesses the ioutputconfigurationprovider and not IContextualOutputConfigurationProvider?

and are you in eclipse or standalone?
e.g. org.eclipse.xtext.builder.EclipseOutputConfigurationProvider.getOutputConfigurations(IProject) is used in eclipse

[Updated on: Thu, 08 March 2018 15:57] by Moderator

Re: Using IContextualOutputConfigurationProvider [message #1783593 is a reply to message #1783181] Wed, 14 March 2018 08:52 Go to previous messageGo to next message
Eclipse UserFriend
Hey Christian,
I'm working in Eclipse.

My problem occurs currently on the outputConfigurationProvider file that I created on my project. There, I have this class:
class MyOutputConfigurationProvider implements IContextualOutputConfigurationProvider { }

And inside I have override Set<OutputConfiguration> getOutputConfigurations(Resource input) { }

Then, on the RuntimeModule of my file, I have added this code:
def Class<? extends IContextualOutputConfigurationProvider> bindIContextualOutputConfigurationProvider() {
MyOutputConfigurationProvider
}

I have these because I want to be able to generate new OutputConfigurations according to data I have on the Resource. So inside my
override Set<OutputConfiguration> getOutputConfigurations(Resource input) { }

I have defined the following:
for(element : input.allContents.toIterable.filter(Element)) {}

And inside of it i generate new outputconfigurations depending on that information.

If instead of using IContextualOutputConfigurationProvider I do everything above using IOutputConfigurationProvider, then it works. But I need to be able to generate the new outputconfigurations according to the elements on the Resource, and for some reason it's not getting called the
override Set<OutputConfiguration> getOutputConfigurations(Resource input) { }

Cheers and thanks beforehand for the help!
Re: Using IContextualOutputConfigurationProvider [message #1783596 is a reply to message #1783593] Wed, 14 March 2018 09:28 Go to previous messageGo to next message
Eclipse UserFriend
I mean: which is the place your provider is not used
Re: Using IContextualOutputConfigurationProvider [message #1783597 is a reply to message #1783596] Wed, 14 March 2018 09:30 Go to previous messageGo to next message
Eclipse UserFriend
(In eclipse the eclipseoutputconfigprovider is bound and used )
Re: Using IContextualOutputConfigurationProvider [message #1783610 is a reply to message #1783597] Wed, 14 March 2018 11:03 Go to previous messageGo to next message
Eclipse UserFriend
My provider is used, what is not getting called is the override Set<OutputConfiguration> getOutputConfigurations(Resource input) { }, but always this one override Set<OutputConfiguration> getOutputConfigurations() { }

So my main question is, is it possible to implement
override Set<OutputConfiguration> getOutputConfigurations(Resource input) { }

without implementing
override Set<OutputConfiguration> getOutputConfigurations() { }

Re: Using IContextualOutputConfigurationProvider [message #1783615 is a reply to message #1783610] Wed, 14 March 2018 11:29 Go to previous messageGo to next message
Eclipse UserFriend
please provide a stacktrace
Re: Using IContextualOutputConfigurationProvider [message #1783746 is a reply to message #1783615] Fri, 16 March 2018 10:22 Go to previous message
Eclipse UserFriend
Hey Christian!

Thanks for your help!

After knowing that in Eclipse the org.eclipse.xtext.builder.EclipseOutputConfigurationProvider.getOutputConfigurations(IProject) is bound and used, I discovered that inside of it the getOutputConfigurations() that doesn't consider any context is always used.

After looking through the forums, I discovered a solution similar to what I needed in here: https://www.eclipse.org/forums/index.php?t=msg&th=1083997&goto=1752776& and was able to solve my problem.

Cheers!
Previous Topic:Unable to execute MWE2Runner with maven
Next Topic:[deleted]
Goto Forum:
  


Current Time: Tue Jul 08 03:30:24 EDT 2025

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

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

Back to the top