Search in sources :

Example 1 with SourceMapping

use of org.eclipse.xtext.generator.OutputConfiguration.SourceMapping in project xtext-xtend by eclipse.

the class XtendProjectConfigurator method writePreferences.

private void writePreferences(OutputConfiguration configuration, IProject project) {
    ProjectScope projectPreferences = new ProjectScope(project);
    IEclipsePreferences languagePreferences = projectPreferences.getNode("org.eclipse.xtend.core.Xtend");
    languagePreferences.putBoolean(OptionsConfigurationBlock.isProjectSpecificPropertyKey(BuilderConfigurationBlock.PROPERTY_PREFIX), true);
    languagePreferences.putBoolean(getKey(configuration, INSTALL_DSL_AS_PRIMARY_SOURCE), configuration.isInstallDslAsPrimarySource());
    languagePreferences.putBoolean(getKey(configuration, HIDE_LOCAL_SYNTHETIC_VARIABLES), configuration.isHideSyntheticLocalVariables());
    languagePreferences.putBoolean(getKey(configuration, USE_OUTPUT_PER_SOURCE_FOLDER), true);
    for (SourceMapping sourceMapping : configuration.getSourceMappings()) {
        languagePreferences.put(getOutputForSourceFolderKey(configuration, sourceMapping.getSourceFolder()), Strings.nullToEmpty(sourceMapping.getOutputDirectory()));
    }
    try {
        languagePreferences.flush();
    } catch (BackingStoreException e) {
        throw new RuntimeIOException(e);
    }
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) RuntimeIOException(org.eclipse.xtext.util.RuntimeIOException) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) BackingStoreException(org.osgi.service.prefs.BackingStoreException) SourceMapping(org.eclipse.xtext.generator.OutputConfiguration.SourceMapping)

Example 2 with SourceMapping

use of org.eclipse.xtext.generator.OutputConfiguration.SourceMapping in project xtext-xtend by eclipse.

the class XtendProjectConfigurator method readCompileConfig.

private void readCompileConfig(OutputConfiguration config, ProjectConfigurationRequest request, MojoExecution execution) throws CoreException {
    for (String source : request.getMavenProject().getCompileSourceRoots()) {
        SourceMapping mapping = new SourceMapping(makeProjectRelative(source, request));
        String outputDirectory = mojoParameterValue("outputDirectory", String.class, request, execution);
        mapping.setOutputDirectory(makeProjectRelative(outputDirectory, request));
        config.getSourceMappings().add(mapping);
    }
}
Also used : SourceMapping(org.eclipse.xtext.generator.OutputConfiguration.SourceMapping)

Example 3 with SourceMapping

use of org.eclipse.xtext.generator.OutputConfiguration.SourceMapping in project xtext-xtend by eclipse.

the class XtendProjectConfigurator method readTestCompileConfig.

private void readTestCompileConfig(OutputConfiguration config, ProjectConfigurationRequest request, MojoExecution execution) throws CoreException {
    for (String source : request.getMavenProject().getTestCompileSourceRoots()) {
        SourceMapping mapping = new SourceMapping(makeProjectRelative(source, request));
        String testOutputDirectory = mojoParameterValue("testOutputDirectory", String.class, request, execution);
        mapping.setOutputDirectory(makeProjectRelative(testOutputDirectory, request));
        config.getSourceMappings().add(mapping);
    }
}
Also used : SourceMapping(org.eclipse.xtext.generator.OutputConfiguration.SourceMapping)

Aggregations

SourceMapping (org.eclipse.xtext.generator.OutputConfiguration.SourceMapping)3 ProjectScope (org.eclipse.core.resources.ProjectScope)1 IEclipsePreferences (org.eclipse.core.runtime.preferences.IEclipsePreferences)1 RuntimeIOException (org.eclipse.xtext.util.RuntimeIOException)1 BackingStoreException (org.osgi.service.prefs.BackingStoreException)1