use of org.eclipse.xtext.xtext.generator.model.JavaFileAccess in project xtext-core by eclipse.
the class IdeaPluginGenerator method compileColorSettingsPage.
public JavaFileAccess compileColorSettingsPage(final Grammar grammar) {
JavaFileAccess _xifexpression = null;
boolean _isGenerateXtendStub = this.isGenerateXtendStub();
if (_isGenerateXtendStub) {
TypeReference _colorSettingsPage = this._ideaPluginClassNames.colorSettingsPage(grammar);
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("class ");
String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.colorSettingsPage(grammar).getSimpleName();
_builder.append(_simpleName);
_builder.append(" extends ");
TypeReference _baseColorSettingsPage = IdeaPluginGenerator.this._ideaPluginClassNames.baseColorSettingsPage(grammar);
_builder.append(_baseColorSettingsPage);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
}
};
_xifexpression = this.fileAccessFactory.createXtendFile(_colorSettingsPage, _client);
} else {
TypeReference _colorSettingsPage_1 = this._ideaPluginClassNames.colorSettingsPage(grammar);
StringConcatenationClient _client_1 = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("public class ");
String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.colorSettingsPage(grammar).getSimpleName();
_builder.append(_simpleName);
_builder.append(" extends ");
TypeReference _baseColorSettingsPage = IdeaPluginGenerator.this._ideaPluginClassNames.baseColorSettingsPage(grammar);
_builder.append(_baseColorSettingsPage);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
}
};
_xifexpression = this.fileAccessFactory.createJavaFile(_colorSettingsPage_1, _client_1);
}
return _xifexpression;
}
use of org.eclipse.xtext.xtext.generator.model.JavaFileAccess in project xtext-core by eclipse.
the class IdeaPluginGenerator method compileCompletionContributor.
public JavaFileAccess compileCompletionContributor(final Grammar grammar) {
JavaFileAccess _xifexpression = null;
boolean _isGenerateXtendStub = this.isGenerateXtendStub();
if (_isGenerateXtendStub) {
TypeReference _completionContributor = this._ideaPluginClassNames.getCompletionContributor(grammar);
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("class ");
String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getCompletionContributor(grammar).getSimpleName();
_builder.append(_simpleName);
_builder.append(" extends ");
TypeReference _abstractCompletionContributor = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractCompletionContributor(grammar);
_builder.append(_abstractCompletionContributor);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("new() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("this(");
TypeReference _ideaLanguage = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar);
_builder.append(_ideaLanguage, "\t\t");
_builder.append(".INSTANCE)");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("new(");
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.lang.AbstractXtextLanguage");
_builder.append(_typeRef, "\t");
_builder.append(" lang) {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("super(lang)");
_builder.newLine();
_builder.append("\t\t");
_builder.append("//custom rules here");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
}
};
_xifexpression = this.fileAccessFactory.createXtendFile(_completionContributor, _client);
} else {
TypeReference _completionContributor_1 = this._ideaPluginClassNames.getCompletionContributor(grammar);
StringConcatenationClient _client_1 = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("public class ");
String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getCompletionContributor(grammar).getSimpleName();
_builder.append(_simpleName);
_builder.append(" extends ");
TypeReference _abstractCompletionContributor = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractCompletionContributor(grammar);
_builder.append(_abstractCompletionContributor);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("public ");
String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getCompletionContributor(grammar).getSimpleName();
_builder.append(_simpleName_1, "\t");
_builder.append("() {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("this(");
TypeReference _ideaLanguage = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar);
_builder.append(_ideaLanguage, "\t\t");
_builder.append(".INSTANCE);");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("public ");
String _simpleName_2 = IdeaPluginGenerator.this._ideaPluginClassNames.getCompletionContributor(grammar).getSimpleName();
_builder.append(_simpleName_2, "\t");
_builder.append("(");
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.lang.AbstractXtextLanguage");
_builder.append(_typeRef, "\t");
_builder.append(" lang) {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("super(lang);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("//custom rules here");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
}
};
_xifexpression = this.fileAccessFactory.createJavaFile(_completionContributor_1, _client_1);
}
return _xifexpression;
}
use of org.eclipse.xtext.xtext.generator.model.JavaFileAccess in project xtext-core by eclipse.
the class SimpleProjectWizardFragment2 method generateProjectInfo.
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());
}
Aggregations