Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Usage of IContextualOutputConfigurationProvider(2)
Usage of IContextualOutputConfigurationProvider(2) [message #1794472] Fri, 31 August 2018 06:18 Go to next message
Oliver Libutzki is currently offline Oliver LibutzkiFriend
Messages: 38
Registered: September 2011
Member
Hi,

in my DSL the outputdirectory depends on the resource. The IOutputConfigurationProvider does not consider any context (like a resource).

I stumbled upon IContextualOutputConfigurationProvider(2) and bound a class which implements these interfaces, but unfortunately IContextualOutputConfigurationProvider.getOutputConfigurations(Resource) seems not to be called.

How can I achieve that the methods of IContextualOutputConfigurationProvider(2) are called?

Kind regrads
Oliver
Re: Usage of IContextualOutputConfigurationProvider(2) [message #1794473 is a reply to message #1794472] Fri, 31 August 2018 06:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12229
Registered: July 2009
Senior Member
what is your exact usecase. in eclipse EclipseOutputConfigurationProvider is used

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Usage of IContextualOutputConfigurationProvider(2) [message #1794474 is a reply to message #1794473] Fri, 31 August 2018 06:38 Go to previous messageGo to next message
Oliver Libutzki is currently offline Oliver LibutzkiFriend
Messages: 38
Registered: September 2011
Member
There are a couple of properties which affect how the generator works. In order to use the same properties in Eclipse and standalone I do not want to rely on Eclipse APIs (Preferences) and just would like to use a simple properties file.

This properties file is located next to my model resources. One property is the outputdirectory of a certain outputconfigurationame, something like:
outputdirectory.GEN_JAVA=target/generated-sources/main


But there are also properties which do not apply to output configuration. Think about a feature toggle to enable/disable the generation of interfaces.

I need this because my generator is a configurable platform which is used for multiple projects which have different requirements. These feature toggles are a way to configure the code generation without the need create plugins which bind other implementations.

To cut a long story short, I would like to configure the DSL/generator in my model project and the configuration should apply to Eclipse and standalone (Maven).
Re: Usage of IContextualOutputConfigurationProvider(2) [message #1794480 is a reply to message #1794474] Fri, 31 August 2018 07:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12229
Registered: July 2009
Senior Member
you should debug after EclipseOutputConfigurationProvider in eclipse?
or is your "no working" for the standalone case the question is which infrastructure do you use.
i am not sure that the maven one uses that at all


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Usage of IContextualOutputConfigurationProvider(2) [message #1794492 is a reply to message #1794480] Fri, 31 August 2018 09:58 Go to previous message
Oliver Libutzki is currently offline Oliver LibutzkiFriend
Messages: 38
Registered: September 2011
Member
The only solution I found is to override org.eclipse.xtext.builder.BuilderParticipant.getOutputConfigurations(IBuildContext);

	@Override
	protected Map<String, OutputConfiguration> getOutputConfigurations(IBuildContext context) {
		
		Set<OutputConfiguration> configurations = getOutputConfigurationProvider().getOutputConfigurations(context.getResourceSet());
		return uniqueIndex(configurations, new Function<OutputConfiguration, String>() {
			@Override
			public String apply(OutputConfiguration from) {
				return from.getName();
			}
		});
	}


I found a similar thread here: https://www.eclipse.org/forums/index.php?t=msg&th=1083997&goto=1752776&
Previous Topic:Library issue with New Project Wizard in 2.14
Next Topic:Using WS as delimiter in part of grammar
Goto Forum:
  


Current Time: Wed Sep 19 18:14:00 GMT 2018

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

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

Back to the top