本文整理汇总了Java中org.eclipse.xtext.generator.JavaIoFileSystemAccess类的典型用法代码示例。如果您正苦于以下问题:Java JavaIoFileSystemAccess类的具体用法?Java JavaIoFileSystemAccess怎么用?Java JavaIoFileSystemAccess使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JavaIoFileSystemAccess类属于org.eclipse.xtext.generator包,在下文中一共展示了JavaIoFileSystemAccess类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import org.eclipse.xtext.generator.JavaIoFileSystemAccess; //导入依赖的package包/类
@Before
public void setup() throws Exception {
temporaryOutputDirectory = Files.createTempDir();
temporaryOutputDirectory.deleteOnExit();
InvocationArguments arguments = new InvocationArguments();
arguments.setGenerationLanguage("java");
arguments.setModelPath("src/test/resources");
arguments.setOutputPath(temporaryOutputDirectory.getAbsolutePath());
Injector francaInjector = new FrancaIDLStandaloneSetup().createInjectorAndDoEMFRegistration()
.createChildInjector(new AbstractModule() {
@Override
protected void configure() {
bind(IFileSystemAccess.class).to(JavaIoFileSystemAccess.class);
}
});
francaInjector.injectMembers(this);
generator = new JoynrJavaGenerator();
Injector injector = francaInjector.createChildInjector(generator.getGeneratorModule());
injector.injectMembers(this);
injector.injectMembers(generator);
FileSystemAccessUtil.createFileSystemAccess(outputFileSystem, arguments.getOutputPath());
}
示例2: generate
import org.eclipse.xtext.generator.JavaIoFileSystemAccess; //导入依赖的package包/类
protected void generate(final List<Resource> sourceResources) {
final GeneratorContext context = new GeneratorContext();
context.setCancelIndicator(CancelIndicator.NullImpl);
for (final Resource it : sourceResources) {
{
String _lastSegment = it.getURI().lastSegment();
String _plus = ("Starting generator for input: \'" + _lastSegment);
String _plus_1 = (_plus + "\'");
StandaloneBuilder.LOG.info(_plus_1);
this.registerCurrentSource(it.getURI());
final LanguageAccess access = this.languageAccess(it.getURI());
final JavaIoFileSystemAccess fileSystemAccess = this.getFileSystemAccess(access);
boolean _isWriteStorageResources = this.isWriteStorageResources();
if (_isWriteStorageResources) {
boolean _matched = false;
if (it instanceof StorageAwareResource) {
IResourceStorageFacade _resourceStorageFacade = ((StorageAwareResource)it).getResourceStorageFacade();
boolean _tripleNotEquals = (_resourceStorageFacade != null);
if (_tripleNotEquals) {
_matched=true;
((StorageAwareResource)it).getResourceStorageFacade().saveResource(((StorageAwareResource)it), fileSystemAccess);
}
}
}
access.getGenerator().generate(it, fileSystemAccess, context);
}
}
}
示例3: getFileSystemAccess
import org.eclipse.xtext.generator.JavaIoFileSystemAccess; //导入依赖的package包/类
private JavaIoFileSystemAccess getFileSystemAccess(final LanguageAccess language) {
JavaIoFileSystemAccess fsa = this.configuredFsas.get(language);
if ((fsa == null)) {
File _file = new File(this.baseDir);
fsa = language.createFileSystemAccess(_file);
fsa = this.configureFileSystemAccess(fsa, language);
this.configuredFsas.put(language, fsa);
}
return fsa;
}
示例4: Executor
import org.eclipse.xtext.generator.JavaIoFileSystemAccess; //导入依赖的package包/类
public Executor(final InvocationArguments arguments) throws ClassNotFoundException,
InstantiationException,
IllegalAccessException {
arguments.checkArguments();
this.arguments = arguments;
// Get an injector and inject into the current instance
Injector francaInjector = new FrancaIDLStandaloneSetup().createInjectorAndDoEMFRegistration();
// Use a child injector that contains configuration parameters passed to this Executor
Injector injector = francaInjector.createChildInjector(new AbstractModule() {
@Override
protected void configure() {
bind(IFileSystemAccess.class).to(JavaIoFileSystemAccess.class);
String generationId = arguments.getGenerationId();
if (generationId != null) {
bindConstant().annotatedWith(Names.named("generationId")).to(generationId);
} else {
// Guice does not allow null binding - use an empty string to show there is no generationId
bindConstant().annotatedWith(Names.named("generationId")).to("");
}
bind(Boolean.class).annotatedWith(Names.named(JoynrGeneratorExtensions.JOYNR_GENERATOR_GENERATE))
.toInstance(arguments.generate());
bind(Boolean.class).annotatedWith(Names.named(JoynrGeneratorExtensions.JOYNR_GENERATOR_CLEAN))
.toInstance(arguments.clean());
}
});
this.outputFileSystem = injector.getInstance(IFileSystemAccess.class);
this.generator = createGenerator(injector);
}
示例5: N4HeadlessCompiler
import org.eclipse.xtext.generator.JavaIoFileSystemAccess; //导入依赖的package包/类
/**
* Private constructor to prevent accidental instantiation.
*/
@Inject
private N4HeadlessCompiler(JavaIoFileSystemAccess fsa) {
this.fsa = fsa;
}
示例6: bindAbstractFileSystemAccess2
import org.eclipse.xtext.generator.JavaIoFileSystemAccess; //导入依赖的package包/类
public Class<? extends AbstractFileSystemAccess2> bindAbstractFileSystemAccess2() {
return JavaIoFileSystemAccess.class;
}
示例7: createFileSystemAccess
import org.eclipse.xtext.generator.JavaIoFileSystemAccess; //导入依赖的package包/类
public JavaIoFileSystemAccess createFileSystemAccess(final File baseDir) {
JavaIoFileSystemAccess fsa = resourceServiceProvider.get(JavaIoFileSystemAccess.class);
configureFileSystemAccess(baseDir, fsa);
return fsa;
}
示例8: bindJavaIoFileSystemAccess
import org.eclipse.xtext.generator.JavaIoFileSystemAccess; //导入依赖的package包/类
protected Class<JavaIoFileSystemAccess> bindJavaIoFileSystemAccess() {
return JavaIoFileSystemAccess.class;
}
示例9: configureFileSystemAccess
import org.eclipse.xtext.generator.JavaIoFileSystemAccess; //导入依赖的package包/类
protected JavaIoFileSystemAccess configureFileSystemAccess(final JavaIoFileSystemAccess fsa, final LanguageAccess language) {
return fsa;
}
示例10: resetGenerationSettings
import org.eclipse.xtext.generator.JavaIoFileSystemAccess; //导入依赖的package包/类
private void resetGenerationSettings(final String projectPath, final String path) {
GenerationStep.javaPackagePrefix = SensIDLConstants.JAVA_PROJECT_PACKAGE_PREFIX;
String _filePathOf = this.getFilePathOf(path);
FileGenerationStep.setFilePath(_filePathOf);
((JavaIoFileSystemAccess) this.fsa).setOutputPath(projectPath);
}
示例11: generate
import org.eclipse.xtext.generator.JavaIoFileSystemAccess; //导入依赖的package包/类
/**
* Start the Code generator
*
* @param path
* the path where the files will be saves
* @param modelPath
* the path to the model form with the code will be generated
* @param language
* the language in which the Code will be generated
* @return true if the code was generated
* @throws NoSidlFileException
* Throws this Exception when the given file is not a sidl file
* @throws FileNotFoundException
* Throws this Exception when there is no file at the given path
*
*/
public static boolean generate(String path, String modelPath, String language, Resource sensidlmodel)
throws NoSidlFileException, FileNotFoundException {
setGenerationLanguage(language);
Injector injector = new SensidlStandaloneSetup().createInjectorAndDoEMFRegistration();
// get resource
Resource resource = null;
if (sensidlmodel != null) {
resource = sensidlmodel;
} else {
ResourceSet rs = new ResourceSetImpl();
File file = new File(modelPath);
// Exception handling for not existing input files
if (!file.exists()) {
throw new FileNotFoundException("File not found");
}
// Exception handling for input files in the wrong format
if (!FilenameUtils.getExtension(modelPath).equals("sidl")) {
throw new NoSidlFileException("No SIDL file found");
}
resource = rs.getResource(URI.createURI(file.toURI().toString()), true);
}
// Use the JavaIoFileSystemAccess and set the path
final JavaIoFileSystemAccess fsa = new JavaIoFileSystemAccess();
fsa.setOutputPath(path);
generator = injector.getInstance(SensidlGenerator.class); // set up the
// generator
generator.setGenerationLanguage(generationLanguage);
// inject fsa
Guice.createInjector(new AbstractGenericModule() {
@SuppressWarnings("unused")
public Class<? extends IEncodingProvider> bindIEncodingProvider() {
return IEncodingProvider.Runtime.class;
}
}).injectMembers(fsa);
// generate
generator.doGenerate(resource, fsa);
return true;
}