Search in sources :

Example 1 with GeneratorContext

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

the class XtendBatchCompiler method generateJavaFiles.

protected void generateJavaFiles(ResourceSet resourceSet) {
    JavaIoFileSystemAccess javaIoFileSystemAccess = javaIoFileSystemAccessProvider.get();
    javaIoFileSystemAccess.setOutputPath(outputPath);
    javaIoFileSystemAccess.setWriteTrace(writeTraceFiles);
    GeneratorContext context = new GeneratorContext();
    context.setCancelIndicator(CancelIndicator.NullImpl);
    for (Resource resource : newArrayList(resourceSet.getResources())) {
        if (isSourceFile(resource)) {
            if (isWriteStorageFiles()) {
                StorageAwareResource storageAwareResource = (StorageAwareResource) resource;
                storageAwareResource.getResourceStorageFacade().saveResource(storageAwareResource, javaIoFileSystemAccess);
            }
            generator.generate(resource, javaIoFileSystemAccess, context);
        }
    }
}
Also used : JavaIoFileSystemAccess(org.eclipse.xtext.generator.JavaIoFileSystemAccess) Resource(org.eclipse.emf.ecore.resource.Resource) StorageAwareResource(org.eclipse.xtext.resource.persistence.StorageAwareResource) XtextResource(org.eclipse.xtext.resource.XtextResource) BatchLinkableResource(org.eclipse.xtext.xbase.resource.BatchLinkableResource) StorageAwareResource(org.eclipse.xtext.resource.persistence.StorageAwareResource) GeneratorContext(org.eclipse.xtext.generator.GeneratorContext)

Aggregations

Resource (org.eclipse.emf.ecore.resource.Resource)1 GeneratorContext (org.eclipse.xtext.generator.GeneratorContext)1 JavaIoFileSystemAccess (org.eclipse.xtext.generator.JavaIoFileSystemAccess)1 XtextResource (org.eclipse.xtext.resource.XtextResource)1 StorageAwareResource (org.eclipse.xtext.resource.persistence.StorageAwareResource)1 BatchLinkableResource (org.eclipse.xtext.xbase.resource.BatchLinkableResource)1