Java 类org.eclipse.xtext.xbase.compiler.GeneratorConfigProvider 实例源码

项目:xtext-extras    文件:CompilationTestHelper.java   
/**
 * Parses, validates and compiles the given source. Calls the given acceptor for each
 * resource which is generated from the source.
 *  
 * @param resourceSet - the {@link ResourceSet} to use
 * @param acceptor gets called once for each file generated in {@link IGenerator}
 */
public void compile(final ResourceSet resourceSet, IAcceptor<Result> acceptor) {
    try {
        List<Resource> resourcesToCheck = newArrayList(resourceSet.getResources());
        if (generatorConfigProvider instanceof GeneratorConfigProvider) {
            GeneratorConfigProvider configProvider = (GeneratorConfigProvider) generatorConfigProvider;
            GeneratorConfig config = generatorConfigProvider.get(null);
            config.setJavaSourceVersion(javaCompiler.getJavaVersion());
            GeneratorConfig existent = configProvider.install(resourceSet, config);
            if (existent != null) {
                existent.setJavaSourceVersion(javaCompiler.getJavaVersion());
                configProvider.install(resourceSet, existent);
            }
        }
        Result result = resultProvider.get();
        result.setJavaCompiler(javaCompiler);
        result.setCheckMode(getCheckMode());
        result.setResources(resourcesToCheck);
        result.setResourceSet(resourceSet);
        result.setOutputConfigurations(getOutputConfigurations());
        result.doGenerate();
        acceptor.accept(result);
    } catch (Exception e) {
        Exceptions.throwUncheckedException(e);
    }
}
项目:dsl-devkit    文件:CheckUiModule.java   
/**
 * Fix for NPE in EclipseGeneratorConfigProvider.
 * 
 * @return GeneratorConfigProvider
 */
@Override
public Class<? extends IGeneratorConfigProvider> bindIGeneratorConfigProvider() {
  return GeneratorConfigProvider.class;
}
项目:dsl-devkit    文件:CheckCfgUiModule.java   
/**
 * Fix for NPE in EclipseGeneratorConfigProvider.
 *
 * @return GeneratorConfigProvider
 */
@Override
public Class<? extends IGeneratorConfigProvider> bindIGeneratorConfigProvider() {
  return GeneratorConfigProvider.class;
}