use of org.eclipse.xtext.xtext.generator.model.TypeReference 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.xtext.xtext.generator.model.TypeReference 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.xtext.xtext.generator.model.TypeReference 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.xtext.xtext.generator.model.TypeReference 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;
}
use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.
the class IdeaPluginGenerator method compileAntlrTokenFileProvider.
public JavaFileAccess compileAntlrTokenFileProvider(final Grammar grammar) {
TypeReference _antlrTokenFileProvider = this._ideaPluginClassNames.getAntlrTokenFileProvider(grammar);
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("public class ");
String _simpleName = IdeaPluginGenerator.this._ideaPluginClassNames.getAntlrTokenFileProvider(grammar).getSimpleName();
_builder.append(_simpleName);
_builder.append(" implements ");
_builder.append(IAntlrTokenFileProvider.class);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("@");
_builder.append(Override.class, "\t");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("public ");
_builder.append(InputStream.class, "\t");
_builder.append(" getAntlrTokenFile() {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append(ClassLoader.class, "\t\t");
_builder.append(" classLoader = getClass().getClassLoader();");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("return classLoader.getResourceAsStream(\"");
String _tokens = IdeaPluginGenerator.this._ideaPluginClassNames.getTokens(grammar);
_builder.append(_tokens, "\t\t");
_builder.append("\");");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
}
};
return this.fileAccessFactory.createJavaFile(_antlrTokenFileProvider, _client);
}
Aggregations