Java Code Examples for org.eclipse.xtext.generator.AbstractFileSystemAccess2#setOutputConfigurations()

The following examples show how to use org.eclipse.xtext.generator.AbstractFileSystemAccess2#setOutputConfigurations() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private void configureFileSystemAccess(final File baseDir, AbstractFileSystemAccess2 fsa) {
	Set<OutputConfiguration> confsForFsa = Sets.newHashSet();
	Set<OutputConfiguration> pomOutputConfigs = getConfiguredOutputConfigs();
	if (pomOutputConfigs != null && !pomOutputConfigs.isEmpty()) {
		for (OutputConfiguration pomConfig : pomOutputConfigs) {
			if (getOutputConfigurationProvider().getOutputConfigurations().contains(pomConfig)) {
				confsForFsa.add(pomConfig);
			} else {
				LOG.warn("Output '" + pomConfig.getName() 
							+ "' is not configured in OutputConfigurationProvider. Used provider "
							+ getOutputConfigurationProvider().getClass().getName());
			}
		}
	}
	confsForFsa.addAll(getOutputConfigurationProvider().getOutputConfigurations());
	Map<String, OutputConfiguration> asMap = IterableExtensions.toMap(
			Iterables.transform(confsForFsa, new Function<OutputConfiguration, OutputConfiguration>() {

				@Override
				public OutputConfiguration apply(OutputConfiguration output) {
					output.setOutputDirectory(resolveToBaseDir(output.getOutputDirectory(), baseDir));
					for (SourceMapping sourceMapping : output.getSourceMappings()) {
						sourceMapping.setOutputDirectory(resolveToBaseDir(sourceMapping.getOutputDirectory(), baseDir));
					}
					return output;
				}
			}), new Function1<OutputConfiguration, String>() {
				@Override
				public String apply(final OutputConfiguration it) {
					return it.getName();
				}
			});
	fsa.setOutputConfigurations(asMap);
}
 
Example 2
protected AbstractFileSystemAccess2 getFileSystemAccess(StorageAwareResource resource) {
	AbstractFileSystemAccess2 fsa = fileSystemAccessProvider.get();
	fsa.setContext(resource);
	fsa.setOutputConfigurations(
			toMap(outputConfigurationProvider.getOutputConfigurations(resource), it -> it.getName()));
	return fsa;
}