Java Code Examples for org.eclipse.xtext.generator.OutputConfiguration#SourceMapping

The following examples show how to use org.eclipse.xtext.generator.OutputConfiguration#SourceMapping . 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
Source File: StandaloneBuilderTest.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Set<OutputConfiguration> getOutputConfigurations() {
	OutputConfiguration config = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT);
	config.setOutputDirectory("src-gen");
	if (useOutputPerSource) {
		SourceMapping sourceMapping = new OutputConfiguration.SourceMapping("src2");
		sourceMapping.setOutputDirectory("src2-gen");
		config.getSourceMappings().add(sourceMapping);
		config.setUseOutputPerSourceFolder(true);
	}
	return ImmutableSet.of(config);
}
 
Example 2
Source File: StandaloneBuilderTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Set<OutputConfiguration> getOutputConfigurations() {
	OutputConfiguration config = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT);
	config.setOutputDirectory("src-gen");
	if (useOutputPerSource) {
		SourceMapping sourceMapping = new OutputConfiguration.SourceMapping("src2");
		sourceMapping.setOutputDirectory("src2-gen");
		config.getSourceMappings().add(sourceMapping);
		config.setUseOutputPerSourceFolder(true);
	}
	return ImmutableSet.of(config);
}
 
Example 3
Source File: ProjectAwareUniqueClassNameValidatorTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testIfDerived_MavenPath() {
	OutputConfiguration output = new OutputConfiguration("TEST");
	output.setOutputDirectory("xtend_gen");
	OutputConfiguration.SourceMapping sourceMapping = new OutputConfiguration.SourceMapping("src/main/xtend_gen");
	output.getSourceMappings().add(sourceMapping);
	classNameValidator.getContext().put("ProjectAwareUniqueClassNameValidator.outputConfigs", Lists.newArrayList(output));
	MockedFile file = new MockedFile(new Path("foo/src/main/xtend_gen/org/eclipse/test/foo.bar"), null);
	Assert.assertTrue(classNameValidator.isDerived(file));
}
 
Example 4
Source File: ProjectAwareUniqueClassNameValidatorTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testIfDerived_MavenPath_3() {
	OutputConfiguration output = new OutputConfiguration("TEST");
	output.setOutputDirectory("xtend_gen");
	OutputConfiguration.SourceMapping sourceMapping = new OutputConfiguration.SourceMapping("src/main/xtend_gen");
	output.getSourceMappings().add(sourceMapping);
	classNameValidator.getContext().put("ProjectAwareUniqueClassNameValidator.outputConfigs", Lists.newArrayList(output));
	MockedFile file = new MockedFile(new Path("foo/src/main/src/org/eclipse/test/foo.bar"), null);
	Assert.assertFalse(classNameValidator.isDerived(file));
}
 
Example 5
Source File: ProjectAwareUniqueClassNameValidatorTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testIfDerived_MavenPath_4() {
	OutputConfiguration output = new OutputConfiguration("TEST");
	output.setOutputDirectory("xtend_gen");
	OutputConfiguration.SourceMapping sourceMapping = new OutputConfiguration.SourceMapping("src/main/xtend_gen");
	output.getSourceMappings().add(sourceMapping);
	OutputConfiguration.SourceMapping sourceMapping2 = new OutputConfiguration.SourceMapping("src/test/xtend_gen");
	output.getSourceMappings().add(sourceMapping2);
	classNameValidator.getContext().put("ProjectAwareUniqueClassNameValidator.outputConfigs", Lists.newArrayList(output));
	MockedFile file = new MockedFile(new Path("foo/src/test/xtend_gen/org/eclipse/test/foo.bar"), null);
	Assert.assertTrue(classNameValidator.isDerived(file));
}
 
Example 6
Source File: ProjectAwareUniqueClassNameValidatorTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testIfDerived_Plain() {
	OutputConfiguration output = new OutputConfiguration("TEST");
	output.setOutputDirectory("xtend_gen");
	OutputConfiguration.SourceMapping sourceMapping = new OutputConfiguration.SourceMapping("xtend_gen");
	output.getSourceMappings().add(sourceMapping);
	classNameValidator.getContext().put("ProjectAwareUniqueClassNameValidator.outputConfigs", Lists.newArrayList(output));
	MockedFile file = new MockedFile(new Path("foo/xtend_gen/org/eclipse/test/foo.bar"), null);
	Assert.assertTrue(classNameValidator.isDerived(file));
}