@Override protected void configure() { this.<Resource.Factory>bind(Resource.Factory.class).to(JavaResource.Factory.class); this.<IResourceValidator>bind(IResourceValidator.class).toInstance(IResourceValidator.NULL); this.<IGenerator>bind(IGenerator.class).to(IGenerator.NullGenerator.class); this.<IEncodingProvider>bind(IEncodingProvider.class).to(IEncodingProvider.Runtime.class); this.<IResourceServiceProvider>bind(IResourceServiceProvider.class).to(JavaResourceServiceProvider.class); this.<IContainer.Manager>bind(IContainer.Manager.class).to(SimpleResourceDescriptionsBasedContainerManager.class); this.<IResourceDescription.Manager>bind(IResourceDescription.Manager.class).to(JavaResourceDescriptionManager.class); this.<IQualifiedNameProvider>bind(IQualifiedNameProvider.class).to(JvmIdentifiableQualifiedNameProvider.class); this.<String>bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("java"); this.<String>bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("org.eclipse.xtext.java.Java"); this.<IJvmTypeProvider.Factory>bind(IJvmTypeProvider.Factory.class).to(ClasspathTypeProviderFactory.class); this.<ClassLoader>bind(ClassLoader.class).toInstance(JavaSourceLanguageRuntimeModule.class.getClassLoader()); this.<IReferableElementsUnloader>bind(IReferableElementsUnloader.class).to(IReferableElementsUnloader.GenericUnloader.class); final IResourceDescriptionsProvider _function = (ResourceSet it) -> { return ChunkedResourceDescriptions.findInEmfObject(it); }; this.<IResourceDescriptionsProvider>bind(IResourceDescriptionsProvider.class).toInstance(_function); }
public void printHelp(Log log) { IGenerator generator = executor.getGenerator(); if (generator instanceof IJoynrGenerator) { IJoynrGenerator joynrGenerator = (IJoynrGenerator) generator; Set<String> parameters = joynrGenerator.supportedParameters(); StringBuffer sb = new StringBuffer(); sb.append("Supported configuration parameters by the generator: "); if (parameters != null && parameters.size() > 0) { for (String parameter : parameters) { sb.append(parameter + ","); } sb.deleteCharAt(sb.length() - 1); } else { sb.append("none"); } log.info(sb.toString()); } else { log.info("no additional information available for the provider generator"); } }
private IGenerator createGenerator(Injector injector) throws ClassNotFoundException, InstantiationException, IllegalAccessException { String rootGenerator = arguments.getRootGenerator(); Class<?> rootGeneratorClass = Class.forName(rootGenerator, true, Thread.currentThread().getContextClassLoader()); Object templateRootInstance = rootGeneratorClass.newInstance(); if (templateRootInstance instanceof IGenerator) { // This is a standard generator IGenerator generator = (IGenerator) templateRootInstance; if (generator instanceof IJoynrGenerator) { IJoynrGenerator joynrGenerator = (IJoynrGenerator) generator; if (joynrGenerator.getGeneratorModule() != null) { injector = injector.createChildInjector(joynrGenerator.getGeneratorModule()); } injector.injectMembers(generator); joynrGenerator.setParameters(arguments.getParameter()); } else { injector.injectMembers(generator); } return generator; } else { throw new IllegalStateException("Root generator \"" + "\" is not implementing interface \"" + IGenerator.class.getName() + "\""); } }
protected void invokeGenerator(IGenerator generator, String fileName, String outputDirectory, String... referencedResources) { final IFileSystemAccess fileSystemAccess = createFileSystemAccess(outputDirectory); final URI uri = URI.createFileURI(new File(fileName).getAbsolutePath()); final Set<URI> uris = new HashSet<URI>(); uris.add(uri); for (String refRes : referencedResources) { uris.add(URI.createFileURI(new File(refRes).getAbsolutePath())); } File file = new File(fileName); IUriProvider uriProvider = null; if (file.isDirectory()) { uriProvider = new FolderUriProvider(Sets.newHashSet("fidl"), file); } else { uriProvider = new IUriProvider() { @Override public Iterable<URI> allUris() { return Lists.newArrayList(uris); } }; } ModelStore modelStore = ModelStore.modelsIn(uriProvider); for (URI foundUri : uriProvider.allUris()) { final Resource r = modelStore.getResource(foundUri); generator.doGenerate(r, fileSystemAccess); } }
public Class<? extends IGenerator> bindIGenerator() { return JvmModelGenerator.class; }
public Class<? extends IGenerator> bindIGenerator() { return ContentAssistTestLanguageGenerator.class; }
public Class<? extends IGenerator> bindIGenerator() { return MyGenerator.class; }
@Override public Set<Binding> getGuiceBindingsRt(Grammar grammar) { if (isGenerateStub(grammar)) return new BindFactory().addTypeToType(IGenerator.class.getName(), getGeneratorName(grammar, getNaming())).getBindings(); return Collections.emptySet(); }
/** Creates a properties file in the .settings folder. {@inheritDoc} */ @Override public Class<? extends IGenerator> bindIGenerator() { return CheckCfgGenerator.class; }
@Override public Class<? extends IGenerator> bindIGenerator() { return DataTypesGenerator.class; }
@Override public Class<? extends IGenerator> bindIGenerator() { return AuxGenerator.class; }
public Class<? extends IGenerator> bindIGenerator() { return XtxtUMLGenerator.class; }
public Class<? extends IGenerator> bindIGenerator() { return IGenerator.NullGenerator.class; }
@Override public Class<? extends IGenerator> bindIGenerator() { return ch.vorburger.xobjects.generator.XObjectsJavaGenerator.class; }
public IGenerator getGenerator() { return generator; }
public Class<? extends IGenerator> bindIGenerator() { return NullGenerator.class; }
/** * Avoids to use the default org.eclipse.xtext.xbase.compiler.JvmModelGenerator * when using xbase. * @see org.xtext.example.helloxbase.AbstractHelloXbaseRuntimeModule#bindIGenerator() */ @Override public Class<? extends IGenerator> bindIGenerator() { return ChariotGenerator.class; }
/** * Avoids to use the default org.eclipse.xtext.xbase.compiler.JvmModelGenerator * when using xbase. * @see org.xtext.example.helloxbase.AbstractHelloXbaseRuntimeModule#bindIGenerator() */ @Override public Class<? extends IGenerator> bindIGenerator() { return MMDSLGenerator.class; }