Java 类org.eclipse.xtext.generator.IFileSystemAccess2 实例源码

项目:org.xtext.dsl.restaurante    文件:RestauranteProjectCreator.java   
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;
}
项目:org.xtext.dsl.restaurante    文件:RestauranteNewProjectWizardInitialContents.java   
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);
}
项目:xtext-core    文件:ManifestAccess.java   
@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);
  }
}
项目:xtext-core    文件:IndexTestLanguageGenerator.java   
@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);
    }
  }
}
项目:org.xtext.dsl.restaurante    文件:RestauranteGenerator.java   
@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();
}
项目:xtext-extras    文件:MyGenerator.java   
@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);
    }
  }
}
项目:xtext-extras    文件:FragmentAdapter.java   
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;
  }
}
项目:xtext-core    文件:PluginXmlAccess.java   
@Override
public void writeTo(final IFileSystemAccess2 fileSystemAccess) {
  boolean _isEmpty = this.entries.isEmpty();
  boolean _not = (!_isEmpty);
  if (_not) {
    super.writeTo(fileSystemAccess);
  }
}
项目:xtext-core    文件:FileAwareTestLanguageGenerator.java   
@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, ", "));
    }
项目:xtext-core    文件:NoJdtTestLanguageGenerator.java   
@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, ", "));
}
项目:sadlos2    文件:JenaBasedSadlModelProcessor.java   
private boolean fileExists(IFileSystemAccess2 fsa, String fileName) {
    try {
        return fsa.isFile(fileName);
    } catch (Exception e) {
        return false;
    }
}
项目:bromium    文件:BromiumGenerator.java   
@Override
public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) {
}
项目:gw4e.project    文件:DSLPoliciesGenerator.java   
@Override
public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) {
}
项目:mochalog    文件:PrologGenerator.java   
@Override
   public void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context)
{

   }
项目:org.xtext.dsl.restaurante    文件:RestauranteProjectCreator.java   
@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);
}
项目:OCCI-Studio    文件:OCCIGenerator.java   
@Override
public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) {
}
项目:M2Doc    文件:MyDslGenerator.java   
@Override
public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) {
}
项目:xtext-core    文件:TracingSugar.java   
/**
 * 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);
}
项目:xtext-core    文件:TracingSugar.java   
/**
 * Use to generate a file based on generator node.
 */
public void generateTracedFile(final IFileSystemAccess2 fsa, final String path, final CompositeGeneratorNode rootNode) {
  final GeneratorNodeProcessor.Result result = this.processor.process(rootNode);
  fsa.generateFile(path, result);
}
项目:xtext-core    文件:IndentationAwareUiTestLanguageGenerator.java   
@Override
public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) {
}
项目:xtext-core    文件:PartialContentAssistTestLanguageGenerator.java   
@Override
public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) {
}
项目:xtext-core    文件:PartialSerializationTestLanguageGenerator.java   
@Override
public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) {
}
项目:xtext-core    文件:GeneratorFragment2.java   
protected void doGenerateXtendStubFile() {
  TypeReference _generatorStub = this.getGeneratorStub(this.getGrammar());
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("/**");
      _builder.newLine();
      _builder.append(" ");
      _builder.append("* Generates code from your model files on save.");
      _builder.newLine();
      _builder.append(" ");
      _builder.append("* ");
      _builder.newLine();
      _builder.append(" ");
      _builder.append("* See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation");
      _builder.newLine();
      _builder.append(" ");
      _builder.append("*/");
      _builder.newLine();
      _builder.append("class ");
      String _simpleName = GeneratorFragment2.this.getGeneratorStub(GeneratorFragment2.this.getLanguage().getGrammar()).getSimpleName();
      _builder.append(_simpleName);
      _builder.append(" extends ");
      _builder.append(AbstractGenerator.class);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("override void doGenerate(");
      _builder.append(Resource.class, "\t");
      _builder.append(" resource, ");
      _builder.append(IFileSystemAccess2.class, "\t");
      _builder.append(" fsa, ");
      _builder.append(IGeneratorContext.class, "\t");
      _builder.append(" context) {");
      _builder.newLineIfNotEmpty();
      _builder.append("//\t\tfsa.generateFile(\'greetings.txt\', \'People to greet: \' + ");
      _builder.newLine();
      _builder.append("//\t\t\tresource.allContents");
      _builder.newLine();
      _builder.append("//\t\t\t\t.filter(Greeting)");
      _builder.newLine();
      _builder.append("//\t\t\t\t.map[name]");
      _builder.newLine();
      _builder.append("//\t\t\t\t.join(\', \'))");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  this.fileAccessFactory.createXtendFile(_generatorStub, _client).writeTo(this.getProjectConfig().getRuntime().getSrc());
}
项目:xtext-core    文件:TextFileAccess.java   
public void writeTo(final IFileSystemAccess2 fileSystemAccess) {
  if ((fileSystemAccess != null)) {
    fileSystemAccess.generateFile(this.path, this.getContent());
  }
}
项目:cs2as    文件:ASBHLangGenerator.java   
@Override
public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) {
}
项目:sadlos2    文件:IJenaBasedModelProcessor.java   
void onGenerate(Resource resource, IFileSystemAccess2 fsa, ProcessorContext context);