org.eclipse.xtext.xbase.compiler.IGeneratorConfigProvider Java Examples
The following examples show how to use
org.eclipse.xtext.xbase.compiler.IGeneratorConfigProvider.
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: TestCaseCompiler.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
public void compile(String qualifiedName) throws IOException { ResourceSet set = injector.getInstance(ResourceSet.class); final String from = "src/" + qualifiedName.replace('.', '/') + ".xtend"; final String to = "src-gen/" + qualifiedName.replace('.', '/') + ".java"; Resource res = set.getResource(org.eclipse.emf.common.util.URI.createFileURI(from), true); EcoreUtil.resolveAll(res); if (!res.getErrors().isEmpty()) throw new RuntimeException(res.getErrors().toString()); final File file = new File(to); createFolders(file); FileWriter writer = new FileWriter(file); IXtendJvmAssociations associations = injector.getInstance(IXtendJvmAssociations.class); JvmModelGenerator generator = injector.getInstance(JvmModelGenerator.class); XtendFile xtendFile = (XtendFile)res.getContents().get(0); JvmGenericType inferredType = associations.getInferredType((XtendClass) xtendFile.getXtendTypes().get(0)); GeneratorConfig config = injector.getInstance(IGeneratorConfigProvider.class).get(inferredType); CharSequence javaCode = generator.generateType(inferredType, config); writer.append(javaCode); writer.close(); System.out.println("compiled " + from + " to " + to); }
Example #2
Source File: SingletonGeneratorConfigModule.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
@Override public void configure(Binder binder) { binder.bind(IGeneratorConfigProvider.class).to(GeneratorConfigProvider.class); }
Example #3
Source File: JavaVersionModule.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
@Override public void configure(Binder binder) { binder.bind(IGeneratorConfigProvider.class).toInstance(new GeneratorConfigProvider()); }
Example #4
Source File: DefaultXbaseUiModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IGeneratorConfigProvider> bindIGeneratorConfigProvider() { return EclipseGeneratorConfigProvider.class; }
Example #5
Source File: SingletonGeneratorConfigRuntimeInjectorProvider.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Override public void setupRegistry() { super.setupRegistry(); GeneratorConfig singletonGeneratorConfig = getInjector().getInstance(IGeneratorConfigProvider.class).get(null); savedGeneratorConfig.copy(singletonGeneratorConfig); }
Example #6
Source File: SingletonGeneratorConfigRuntimeInjectorProvider.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Override public void restoreRegistry() { super.restoreRegistry(); GeneratorConfig singletonGeneratorConfig = getInjector().getInstance(IGeneratorConfigProvider.class).get(null); singletonGeneratorConfig.copy(savedGeneratorConfig); }
Example #7
Source File: AbstractSARLRuntimeModule.java From sarl with Apache License 2.0 | 4 votes |
public Class<? extends IGeneratorConfigProvider> bindIGeneratorConfigProvider() { return SARLGeneratorConfigProvider.class; }
Example #8
Source File: CheckUiModule.java From dsl-devkit with Eclipse Public License 1.0 | 2 votes |
/** * Fix for NPE in EclipseGeneratorConfigProvider. * * @return GeneratorConfigProvider */ @Override public Class<? extends IGeneratorConfigProvider> bindIGeneratorConfigProvider() { return GeneratorConfigProvider.class; }
Example #9
Source File: CheckCfgUiModule.java From dsl-devkit with Eclipse Public License 1.0 | 2 votes |
/** * Fix for NPE in EclipseGeneratorConfigProvider. * * @return GeneratorConfigProvider */ @Override public Class<? extends IGeneratorConfigProvider> bindIGeneratorConfigProvider() { return GeneratorConfigProvider.class; }