Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Usage of IContextualOutputConfigurationProvider(2)
Usage of IContextualOutputConfigurationProvider(2) [message #1794472] Fri, 31 August 2018 02:18 Go to next message
Eclipse UserFriend
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 02:24 Go to previous messageGo to next message
Eclipse UserFriend
what is your exact usecase. in eclipse EclipseOutputConfigurationProvider is used
Re: Usage of IContextualOutputConfigurationProvider(2) [message #1794474 is a reply to message #1794473] Fri, 31 August 2018 02:38 Go to previous messageGo to next message
Eclipse UserFriend
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 03:13 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Usage of IContextualOutputConfigurationProvider(2) [message #1794492 is a reply to message #1794480] Fri, 31 August 2018 05:58 Go to previous message
Eclipse UserFriend
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: Sun Jun 15 10:25:29 EDT 2025

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

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

Back to the top