• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IGeneratorContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.xtext.generator.IGeneratorContext的典型用法代码示例。如果您正苦于以下问题:Java IGeneratorContext类的具体用法?Java IGeneratorContext怎么用?Java IGeneratorContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IGeneratorContext类属于org.eclipse.xtext.generator包,在下文中一共展示了IGeneratorContext类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: doGenerate

import org.eclipse.xtext.generator.IGeneratorContext; //导入依赖的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();
}
 
开发者ID:vicegd,项目名称:org.xtext.dsl.restaurante,代码行数:8,代码来源:RestauranteGenerator.java


示例2: doGenerate

import org.eclipse.xtext.generator.IGeneratorContext; //导入依赖的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, ", "));
	}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:13,代码来源:FileAwareTestLanguageGenerator.java


示例3: doGenerate

import org.eclipse.xtext.generator.IGeneratorContext; //导入依赖的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, ", "));
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:NoJdtTestLanguageGenerator.java


示例4: doGenerate

import org.eclipse.xtext.generator.IGeneratorContext; //导入依赖的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);
    }
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:22,代码来源:IndexTestLanguageGenerator.java


示例5: doGenerate

import org.eclipse.xtext.generator.IGeneratorContext; //导入依赖的package包/类
@Override
public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) {
}
 
开发者ID:hristo-vrigazov,项目名称:bromium,代码行数:4,代码来源:BromiumGenerator.java


示例6: doGenerate

import org.eclipse.xtext.generator.IGeneratorContext; //导入依赖的package包/类
@Override
   public void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context)
{

   }
 
开发者ID:mochalog,项目名称:mochalog,代码行数:6,代码来源:PrologGenerator.java


示例7: doGenerateXtendStubFile

import org.eclipse.xtext.generator.IGeneratorContext; //导入依赖的package包/类
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());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:56,代码来源:GeneratorFragment2.java


示例8: doGenerateJavaStubFile

import org.eclipse.xtext.generator.IGeneratorContext; //导入依赖的package包/类
protected void doGenerateJavaStubFile() {
  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("public 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("@");
      _builder.append(Override.class, "\t");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("public 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\tIterator<Greeting> filtered = Iterators.filter(resource.getAllContents(), Greeting.class);");
      _builder.newLine();
      _builder.append("//\t\tIterator<String> names = Iterators.transform(filtered, new Function<Greeting, String>() {");
      _builder.newLine();
      _builder.append("//");
      _builder.newLine();
      _builder.append("//\t\t\[email protected]");
      _builder.append(Override.class);
      _builder.newLineIfNotEmpty();
      _builder.append("//\t\t\tpublic String apply(Greeting greeting) {");
      _builder.newLine();
      _builder.append("//\t\t\t\treturn greeting.getName();");
      _builder.newLine();
      _builder.append("//\t\t\t}");
      _builder.newLine();
      _builder.append("//\t\t});");
      _builder.newLine();
      _builder.append("//\t\tfsa.generateFile(\"greetings.txt\", \"People to greet: \" + IteratorExtensions.join(names, \", \"));");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("}");
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
    }
  };
  this.fileAccessFactory.createJavaFile(_generatorStub, _client).writeTo(this.getProjectConfig().getRuntime().getSrc());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:69,代码来源:GeneratorFragment2.java



注:本文中的org.eclipse.xtext.generator.IGeneratorContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Notifications类代码示例发布时间:2022-05-22
下一篇:
Java TextDecorator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap