本文整理汇总了Java中org.eclipse.xtext.generator.IFileSystemAccess2类的典型用法代码示例。如果您正苦于以下问题:Java IFileSystemAccess2类的具体用法?Java IFileSystemAccess2怎么用?Java IFileSystemAccess2使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IFileSystemAccess2类属于org.eclipse.xtext.generator包,在下文中一共展示了IFileSystemAccess2类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFileSystemAccess
import org.eclipse.xtext.generator.IFileSystemAccess2; //导入依赖的package包/类
protected IFileSystemAccess2 getFileSystemAccess(final IProject project, final IProgressMonitor monitor) {
EclipseResourceFileSystemAccess2 access = fileSystemAccessProvider.get();
access.setContext(project);
access.setMonitor(monitor);
OutputConfiguration defaultOutput = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT);
defaultOutput.setDescription("Output Folder");
defaultOutput.setOutputDirectory("./");
defaultOutput.setOverrideExistingResources(true);
defaultOutput.setCreateOutputDirectory(true);
defaultOutput.setCleanUpDerivedResources(false);
defaultOutput.setSetDerivedProperty(false);
defaultOutput.setKeepLocalHistory(false);
HashMap<String, OutputConfiguration> outputConfigurations = new HashMap<String, OutputConfiguration>();
outputConfigurations.put(IFileSystemAccess.DEFAULT_OUTPUT, defaultOutput);
access.setOutputConfigurations(outputConfigurations);
return access;
}
示例2: generateInitialContents
import org.eclipse.xtext.generator.IFileSystemAccess2; //导入依赖的package包/类
public void generateInitialContents(final IFileSystemAccess2 fsa) {
String _primaryFileExtension = this.fileExtensionProvider.getPrimaryFileExtension();
String _plus = ("src/model/Model." + _primaryFileExtension);
StringConcatenation _builder = new StringConcatenation();
_builder.append("Restaurantes \"Hola\" fecha 30-10-2016");
_builder.newLine();
_builder.newLine();
_builder.append("Ingredientes {");
_builder.newLine();
_builder.append("\t");
_builder.append("Ingrediente: COD1 \'moluscos\' infoURL: http://moluscos.com alergenico");
_builder.newLine();
_builder.append("}");
_builder.newLine();
fsa.generateFile(_plus, _builder);
}
开发者ID:vicegd,项目名称:org.xtext.dsl.restaurante,代码行数:17,代码来源:RestauranteNewProjectWizardInitialContents.java
示例3: writeTo
import org.eclipse.xtext.generator.IFileSystemAccess2; //导入依赖的package包/类
@Override
public void writeTo(final IFileSystemAccess2 fileSystemAccess) {
try {
if ((fileSystemAccess != null)) {
CharSequence _content = this.getContent();
StringBuffer _stringBuffer = new StringBuffer(_content);
final String contentToWrite = MergeableManifest.make512Safe(_stringBuffer, this.lineDelimiter);
byte[] _bytes = contentToWrite.getBytes("UTF-8");
ByteArrayInputStream _byteArrayInputStream = new ByteArrayInputStream(_bytes);
final MergeableManifest mergableManifest = new MergeableManifest(_byteArrayInputStream);
mergableManifest.setLineDelimiter(this.lineDelimiter);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
mergableManifest.write(bout);
byte[] _byteArray = bout.toByteArray();
ByteArrayInputStream _byteArrayInputStream_1 = new ByteArrayInputStream(_byteArray);
fileSystemAccess.generateFile(this.getPath(), _byteArrayInputStream_1);
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例4: doGenerate
import org.eclipse.xtext.generator.IFileSystemAccess2; //导入依赖的package包/类
@Override
public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) {
GeneradorTexto generatorTexto = new GeneradorTexto(resource, fsa);
generatorTexto.compilar();
GeneradorWeb generatorWeb = new GeneradorWeb(resource, fsa);
generatorWeb.compilar();
}
示例5: doGenerate
import org.eclipse.xtext.generator.IFileSystemAccess2; //导入依赖的package包/类
@Override
public void doGenerate(final Resource input, final IFileSystemAccess fsa) {
Iterable<Element> _filter = Iterables.<Element>filter(IteratorExtensions.<EObject>toIterable(input.getAllContents()), Element.class);
for (final Element ele : _filter) {
{
if ((fsa instanceof IFileSystemAccess2)) {
StringConcatenation _builder = new StringConcatenation();
String _name = ele.getName();
_builder.append(_name);
_builder.append(".txt");
boolean _isFile = ((IFileSystemAccess2)fsa).isFile(_builder.toString());
if (_isFile) {
StringConcatenation _builder_1 = new StringConcatenation();
String _name_1 = ele.getName();
_builder_1.append(_name_1);
_builder_1.append(".txt");
((IFileSystemAccess2)fsa).readTextFile(_builder_1.toString());
}
}
StringConcatenation _builder_2 = new StringConcatenation();
String _name_2 = ele.getName();
_builder_2.append(_name_2);
_builder_2.append(".txt");
StringConcatenation _builder_3 = new StringConcatenation();
_builder_3.append("object ");
String _name_3 = ele.getName();
_builder_3.append(_name_3);
fsa.generateFile(_builder_2.toString(), _builder_3);
}
}
}
示例6: getPath
import org.eclipse.xtext.generator.IFileSystemAccess2; //导入依赖的package包/类
protected String getPath(final IFileSystemAccess2 fsa) {
final String path = fsa.getURI("").toFileString();
boolean _endsWith = path.endsWith(File.separator);
if (_endsWith) {
int _length = path.length();
int _minus = (_length - 1);
return path.substring(0, _minus);
} else {
return path;
}
}
示例7: writeTo
import org.eclipse.xtext.generator.IFileSystemAccess2; //导入依赖的package包/类
@Override
public void writeTo(final IFileSystemAccess2 fileSystemAccess) {
boolean _isEmpty = this.entries.isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
super.writeTo(fileSystemAccess);
}
}
示例8: doGenerate
import org.eclipse.xtext.generator.IFileSystemAccess2; //导入依赖的package包/类
@Override
public void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
// Iterator<Greeting> filtered = Iterators.filter(resource.getAllContents(), Greeting.class);
// Iterator<String> names = Iterators.transform(filtered, new Function<Greeting, String>() {
//
// @Override
// public String apply(Greeting greeting) {
// return greeting.getName();
// }
// });
// fsa.generateFile("greetings.txt", "People to greet: " + IteratorExtensions.join(names, ", "));
}
示例9: doGenerate
import org.eclipse.xtext.generator.IFileSystemAccess2; //导入依赖的package包/类
@Override
public void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
Iterator<Greeting> filtered = Iterators.filter(resource.getAllContents(), Greeting.class);
Iterator<String> names = Iterators.transform(filtered, new Function<Greeting, String>() {
@Override
public String apply(Greeting greeting) {
return greeting.getName();
}
});
String fileName = resource.getURI().lastSegment();
if(fileName == null) fileName = "greetings";
fsa.generateFile(fileName+".txt", "People to greet: " + IteratorExtensions.join(names, ", "));
}
示例10: doGenerate
import org.eclipse.xtext.generator.IFileSystemAccess2; //导入依赖的package包/类
@Override
public void doGenerate(final Resource input, final IFileSystemAccess2 fsa, final IGeneratorContext context) {
final TreeIterator<EObject> iter = input.getAllContents();
while (iter.hasNext()) {
EObject _next = iter.next();
final EObject e = _next;
boolean _matched = false;
if (e instanceof Entity) {
_matched=true;
String _name = ((Entity)e).getName();
String _plus = (_name + ".txt");
StringConcatenation _builder = new StringConcatenation();
_builder.append("Hello ");
String _name_1 = ((Entity)e).getName();
_builder.append(_name_1);
_builder.append("!");
_builder.newLineIfNotEmpty();
fsa.generateFile(_plus, _builder);
}
}
}
示例11: fileExists
import org.eclipse.xtext.generator.IFileSystemAccess2; //导入依赖的package包/类
private boolean fileExists(IFileSystemAccess2 fsa, String fileName) {
try {
return fsa.isFile(fileName);
} catch (Exception e) {
return false;
}
}
示例12: doGenerate
import org.eclipse.xtext.generator.IFileSystemAccess2; //导入依赖的package包/类
@Override
public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) {
}
示例13: doGenerate
import org.eclipse.xtext.generator.IFileSystemAccess2; //导入依赖的package包/类
@Override
public void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context)
{
}
示例14: enhanceProject
import org.eclipse.xtext.generator.IFileSystemAccess2; //导入依赖的package包/类
@Override
protected void enhanceProject(final IProject project, final IProgressMonitor monitor) throws CoreException {
IFileSystemAccess2 access = getFileSystemAccess(project, monitor);
initialContents.generateInitialContents(access);
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
示例15: generateTracedFile
import org.eclipse.xtext.generator.IFileSystemAccess2; //导入依赖的package包/类
/**
* Convenience extension, to generate traced code.
*/
public void generateTracedFile(final IFileSystemAccess2 fsa, final String path, final EObject rootTrace, final StringConcatenationClient code) {
final CompositeGeneratorNode node = this.trace(rootTrace, code);
this.generateTracedFile(fsa, path, node);
}