本文整理汇总了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;未经允许,请勿转载。 |
请发表评论