本文整理汇总了Java中org.eclipse.xtext.xtext.generator.model.JavaFileAccess.setContent方法的典型用法代码示例。如果您正苦于以下问题:Java JavaFileAccess.setContent方法的具体用法?Java JavaFileAccess.setContent怎么用?Java JavaFileAccess.setContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.xtext.generator.model.JavaFileAccess
的用法示例。
在下文中一共展示了JavaFileAccess.setContent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateProjectInfo
import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; //导入方法依赖的package包/类
public void generateProjectInfo() {
final TypeReference projectInfoClass = TypeReference.typeRef(this.getProjectInfoClassName());
final JavaFileAccess file = this.fileAccessFactory.createJavaFile(projectInfoClass);
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("public class ");
String _simpleName = projectInfoClass.getSimpleName();
_builder.append(_simpleName);
_builder.append(" extends ");
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.wizard.DefaultProjectInfo");
_builder.append(_typeRef);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("}");
_builder.newLine();
}
};
file.setContent(_client);
file.writeTo(this.getProjectConfig().getEclipsePlugin().getSrc());
}
示例2: generateWizardNewProjectCreationPage
import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; //导入方法依赖的package包/类
public void generateWizardNewProjectCreationPage() {
final TypeReference mainPageClass = TypeReference.typeRef(this.getProjectWizardCreationPageClassName());
final JavaFileAccess file = this.fileAccessFactory.createJavaFile(mainPageClass);
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("public class ");
String _simpleName = mainPageClass.getSimpleName();
_builder.append(_simpleName);
_builder.append(" extends ");
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.ui.dialogs.WizardNewProjectCreationPage");
_builder.append(_typeRef);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
_builder.append("public ");
String _simpleName_1 = mainPageClass.getSimpleName();
_builder.append(_simpleName_1, "\t");
_builder.append("(String pageName) {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("super(pageName);");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
}
};
file.setContent(_client);
file.writeTo(this.getProjectConfig().getEclipsePlugin().getSrc());
}
示例3: generateUiInjectorProvider
import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; //导入方法依赖的package包/类
protected JavaFileAccess generateUiInjectorProvider() {
JavaFileAccess _xblockexpression = null;
{
final JavaFileAccess file = this.fileAccessFactory.createJavaFile(this.uiInjectorProvider());
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("public class ");
String _simpleName = Junit4Fragment2.this.uiInjectorProvider().getSimpleName();
_builder.append(_simpleName);
_builder.append(" implements ");
TypeReference _iInjectorProvider = Junit4Fragment2.this.iInjectorProvider();
_builder.append(_iInjectorProvider);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
_builder.append("@Override");
_builder.newLine();
_builder.append("\t");
_builder.append("public ");
_builder.append(Injector.class, "\t");
_builder.append(" getInjector() {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("return ");
TypeReference _eclipsePluginActivator = Junit4Fragment2.this._xtextGeneratorNaming.getEclipsePluginActivator();
_builder.append(_eclipsePluginActivator, "\t\t");
_builder.append(".getInstance().getInjector(\"");
String _name = Junit4Fragment2.this.getGrammar().getName();
_builder.append(_name, "\t\t");
_builder.append("\");");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
}
};
file.setContent(_client);
_xblockexpression = file;
}
return _xblockexpression;
}
示例4: createJavaFile
import org.eclipse.xtext.xtext.generator.model.JavaFileAccess; //导入方法依赖的package包/类
public JavaFileAccess createJavaFile(final TypeReference typeRef, final StringConcatenationClient content) {
final JavaFileAccess result = this.createJavaFile(typeRef);
result.setContent(content);
return result;
}