use of org.eclipse.xtend2.lib.StringConcatenationClient in project xtext-core by eclipse.
the class IdeaPluginGenerator method compilePluginXml.
public TextFileAccess compilePluginXml(final Grammar grammar) {
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("<idea-plugin version=\"2\" xmlns:xi=\"http://www.w3.org/2001/XInclude\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<id>");
String _ideaBasePackage = IdeaPluginGenerator.this._xtextGeneratorNaming.getIdeaBasePackage(grammar);
_builder.append(_ideaBasePackage, "\t");
_builder.append("</id>");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("<name>");
String _simpleName = IdeaPluginGenerator.this._ideaPluginExtension.getSimpleName(grammar);
_builder.append(_simpleName, "\t");
_builder.append(" Support</name>");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("<description>");
_builder.newLine();
_builder.append("\t\t");
_builder.append("This plugin enables smart editing of ");
String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginExtension.getSimpleName(grammar);
_builder.append(_simpleName_1, "\t\t");
_builder.append(" files.");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("</description>");
_builder.newLine();
_builder.append("\t");
_builder.append("<version>1.0.0</version>");
_builder.newLine();
_builder.append("\t");
_builder.append("<vendor>My Company</vendor>");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("<idea-version since-build=\"145\"/>");
_builder.newLine();
_builder.append("\t");
_builder.append("<depends>org.eclipse.xtext.idea</depends>");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("<xi:include href=\"plugin_gen.xml\" xpointer=\"xpointer(/idea-plugin/*)\"/>");
_builder.newLine();
_builder.append("</idea-plugin>");
_builder.newLine();
}
};
return this.fileAccessFactory.createTextFile("plugin.xml", _client);
}
use of org.eclipse.xtend2.lib.StringConcatenationClient in project xtext-core by eclipse.
the class IdeaPluginGenerator method compileFacetType.
public JavaFileAccess compileFacetType(final Grammar grammar) {
final TypeReference faceTypeId = TypeReference.typeRef("com.intellij.facet.FacetTypeId", TypeReference.typeRef("com.intellij.facet.Facet", this._ideaPluginClassNames.getFacetConfiguration(grammar)));
TypeReference _facetType = this._ideaPluginClassNames.getFacetType(grammar);
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("public class ");
String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getFacetType(grammar).getSimpleName();
_builder.append(_simpleName);
_builder.append(" extends ");
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.facet.AbstractFacetType", IdeaPluginGenerator.this._ideaPluginClassNames.getFacetConfiguration(grammar));
_builder.append(_typeRef);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
_builder.append("public static final ");
_builder.append(faceTypeId, "\t");
_builder.append(" TYPEID = new ");
_builder.append(faceTypeId, "\t");
_builder.append("(\"");
String _name = grammar.getName();
_builder.append(_name, "\t");
_builder.append("\");");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
_builder.append("public ");
String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getFacetType(grammar).getSimpleName();
_builder.append(_simpleName_1, "\t");
_builder.append("() {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("super(TYPEID, \"");
String _name_1 = grammar.getName();
_builder.append(_name_1, "\t\t");
_builder.append("\", \"");
String _simpleName_2 = IdeaPluginGenerator.this._ideaPluginExtension.getSimpleName(grammar);
_builder.append(_simpleName_2, "\t\t");
_builder.append("\");");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
TypeReference _ideaLanguage = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar);
_builder.append(_ideaLanguage, "\t\t");
_builder.append(".INSTANCE.injectMembers(this);");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
}
};
return this.fileAccessFactory.createJavaFile(_facetType, _client);
}
use of org.eclipse.xtend2.lib.StringConcatenationClient in project xtext-core by eclipse.
the class IdeaPluginGenerator method compileLanguage.
public JavaFileAccess compileLanguage(final Grammar grammar) {
TypeReference _ideaLanguage = this._ideaPluginClassNames.getIdeaLanguage(grammar);
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("public final class ");
String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar).getSimpleName();
_builder.append(_simpleName);
_builder.append(" extends ");
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.lang.AbstractXtextLanguage");
_builder.append(_typeRef);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
_builder.append("public static final ");
String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar).getSimpleName();
_builder.append(_simpleName_1, "\t");
_builder.append(" INSTANCE = new ");
String _simpleName_2 = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar).getSimpleName();
_builder.append(_simpleName_2, "\t");
_builder.append("();");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
_builder.append("private ");
String _simpleName_3 = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaLanguage(grammar).getSimpleName();
_builder.append(_simpleName_3, "\t");
_builder.append("() {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("super(\"");
String _languageId = GrammarUtil.getLanguageId(grammar);
_builder.append(_languageId, "\t\t");
_builder.append("\");");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
}
};
return this.fileAccessFactory.createJavaFile(_ideaLanguage, _client);
}
use of org.eclipse.xtend2.lib.StringConcatenationClient in project xtext-core by eclipse.
the class IdeaPluginGenerator method compileFileType.
public JavaFileAccess compileFileType(final Grammar grammar) {
JavaFileAccess _xifexpression = null;
boolean _isGenerateXtendStub = this.isGenerateXtendStub();
if (_isGenerateXtendStub) {
TypeReference _fileType = this._ideaPluginClassNames.getFileType(grammar);
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("class ");
String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar).getSimpleName();
_builder.append(_simpleName);
_builder.append(" extends ");
TypeReference _abstractFileType = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractFileType(grammar);
_builder.append(_abstractFileType);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("public static final ");
String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar).getSimpleName();
_builder.append(_simpleName_1, "\t");
_builder.append(" INSTANCE = new ");
String _simpleName_2 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar).getSimpleName();
_builder.append(_simpleName_2, "\t");
_builder.append("()");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("new() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("super(");
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("}");
_builder.newLine();
}
};
_xifexpression = this.fileAccessFactory.createXtendFile(_fileType, _client);
} else {
TypeReference _fileType_1 = this._ideaPluginClassNames.getFileType(grammar);
StringConcatenationClient _client_1 = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("public class ");
String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar).getSimpleName();
_builder.append(_simpleName);
_builder.append(" extends ");
TypeReference _abstractFileType = IdeaPluginGenerator.this._ideaPluginClassNames.getAbstractFileType(grammar);
_builder.append(_abstractFileType);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("public static final ");
String _simpleName_1 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar).getSimpleName();
_builder.append(_simpleName_1, "\t");
_builder.append(" INSTANCE = new ");
String _simpleName_2 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar).getSimpleName();
_builder.append(_simpleName_2, "\t");
_builder.append("();");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("public ");
String _simpleName_3 = IdeaPluginGenerator.this._ideaPluginClassNames.getFileType(grammar).getSimpleName();
_builder.append(_simpleName_3, "\t");
_builder.append("() {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("super(");
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("}");
_builder.newLine();
}
};
_xifexpression = this.fileAccessFactory.createJavaFile(_fileType_1, _client_1);
}
return _xifexpression;
}
use of org.eclipse.xtend2.lib.StringConcatenationClient in project xtext-core by eclipse.
the class IdeaPluginGenerator method compileIdeaSetup.
public JavaFileAccess compileIdeaSetup(final Grammar grammar) {
JavaFileAccess _xifexpression = null;
boolean _isGenerateXtendStub = this.isGenerateXtendStub();
if (_isGenerateXtendStub) {
TypeReference _ideaSetup = this._ideaPluginClassNames.getIdeaSetup(grammar);
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("class ");
String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaSetup(grammar).getSimpleName();
_builder.append(_simpleName);
_builder.append(" implements ");
_builder.append(ISetup.class);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
_builder.append("override createInjectorAndDoEMFRegistration() {");
_builder.newLine();
_builder.append("\t\t");
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.extensions.EcoreGlobalRegistries");
_builder.append(_typeRef, "\t\t");
_builder.append(".ensureInitialized");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("new ");
TypeReference _ideaStandaloneSetup = IdeaPluginGenerator.this._xtextGeneratorNaming.getIdeaStandaloneSetup(grammar);
_builder.append(_ideaStandaloneSetup, "\t\t");
_builder.append("().createInjector");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
}
};
_xifexpression = this.fileAccessFactory.createXtendFile(_ideaSetup, _client);
} else {
TypeReference _ideaSetup_1 = this._ideaPluginClassNames.getIdeaSetup(grammar);
StringConcatenationClient _client_1 = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("public class ");
String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getIdeaSetup(grammar).getSimpleName();
_builder.append(_simpleName);
_builder.append(" implements ");
_builder.append(ISetup.class);
_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(" createInjectorAndDoEMFRegistration() {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.idea.extensions.EcoreGlobalRegistries");
_builder.append(_typeRef, "\t\t");
_builder.append(".ensureInitialized();");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("return new ");
TypeReference _ideaStandaloneSetup = IdeaPluginGenerator.this._xtextGeneratorNaming.getIdeaStandaloneSetup(grammar);
_builder.append(_ideaStandaloneSetup, "\t\t");
_builder.append("().createInjector();");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
}
};
_xifexpression = this.fileAccessFactory.createJavaFile(_ideaSetup_1, _client_1);
}
return _xifexpression;
}
Aggregations