use of org.eclipse.xtext.xtext.generator.model.ManifestAccess in project xtext-core by eclipse.
the class QuickOutlineFragment2 method generate.
@Override
public void generate() {
ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest();
boolean _tripleNotEquals = (_manifest != null);
if (_tripleNotEquals) {
Set<String> _requiredBundles = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles();
_requiredBundles.add("org.eclipse.xtext.ui");
}
PluginXmlAccess _pluginXml = this.getProjectConfig().getEclipsePlugin().getPluginXml();
boolean _tripleNotEquals_1 = (_pluginXml != null);
if (_tripleNotEquals_1) {
List<CharSequence> _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries();
StringConcatenation _builder = new StringConcatenation();
_builder.append("<!-- Quick Outline -->");
_builder.newLine();
_builder.append("<extension");
_builder.newLine();
_builder.append("\t");
_builder.append("point=\"org.eclipse.ui.handlers\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<handler ");
_builder.newLine();
_builder.append("\t\t");
_builder.append("class=\"");
TypeReference _eclipsePluginExecutableExtensionFactory = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar());
_builder.append(_eclipsePluginExecutableExtensionFactory, "\t\t");
_builder.append(":org.eclipse.xtext.ui.editor.outline.quickoutline.ShowQuickOutlineActionHandler\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("commandId=\"org.eclipse.xtext.ui.editor.outline.QuickOutline\">");
_builder.newLine();
_builder.append("\t\t");
_builder.append("<activeWhen>");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("<reference");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("definitionId=\"");
String _name = this.getGrammar().getName();
_builder.append(_name, "\t\t\t\t");
_builder.append(".Editor.opened\">");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t");
_builder.append("</reference>");
_builder.newLine();
_builder.append("\t\t");
_builder.append("</activeWhen>");
_builder.newLine();
_builder.append("\t");
_builder.append("</handler>");
_builder.newLine();
_builder.append("</extension>");
_builder.newLine();
_builder.append("<extension");
_builder.newLine();
_builder.append("\t");
_builder.append("point=\"org.eclipse.ui.commands\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<command");
_builder.newLine();
_builder.append("\t\t");
_builder.append("description=\"Open the quick outline.\"");
_builder.newLine();
_builder.append("\t\t");
_builder.append("id=\"org.eclipse.xtext.ui.editor.outline.QuickOutline\"");
_builder.newLine();
_builder.append("\t\t");
_builder.append("name=\"Quick Outline\">");
_builder.newLine();
_builder.append("\t");
_builder.append("</command>");
_builder.newLine();
_builder.append("</extension>");
_builder.newLine();
_builder.append("<extension point=\"org.eclipse.ui.menus\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<menuContribution");
_builder.newLine();
_builder.append("\t\t");
_builder.append("locationURI=\"popup:#TextEditorContext?after=group.open\">");
_builder.newLine();
_builder.append("\t\t");
_builder.append("<command commandId=\"org.eclipse.xtext.ui.editor.outline.QuickOutline\"");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("style=\"push\"");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("tooltip=\"Open Quick Outline\">");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("<visibleWhen checkEnabled=\"false\">");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("<reference definitionId=\"");
String _name_1 = this.getGrammar().getName();
_builder.append(_name_1, "\t\t\t\t");
_builder.append(".Editor.opened\"/>");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t");
_builder.append("</visibleWhen>");
_builder.newLine();
_builder.append("\t\t");
_builder.append("</command>");
_builder.newLine();
_builder.append("\t");
_builder.append("</menuContribution>");
_builder.newLine();
_builder.append("</extension>");
_builder.newLine();
_entries.add(_builder.toString());
}
}
use of org.eclipse.xtext.xtext.generator.model.ManifestAccess in project xtext-core by eclipse.
the class QuickfixProviderFragment2 method generate.
@Override
public void generate() {
GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.editor.quickfix.IssueResolutionProvider");
_bindingFactory.addTypeToType(_typeReference, this.getQuickfixProviderClass(this.getGrammar())).contributeTo(this.getLanguage().getEclipsePluginGenModule());
boolean _isGenerateStub = this.isGenerateStub();
if (_isGenerateStub) {
IBundleProjectConfig _eclipsePlugin = this.getProjectConfig().getEclipsePlugin();
IXtextGeneratorFileSystemAccess _src = null;
if (_eclipsePlugin != null) {
_src = _eclipsePlugin.getSrc();
}
boolean _tripleNotEquals = (_src != null);
if (_tripleNotEquals) {
boolean _isGenerateXtendStub = this.isGenerateXtendStub();
if (_isGenerateXtendStub) {
this.generateXtendQuickfixProvider();
} else {
this.generateJavaQuickfixProvider();
}
}
ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest();
boolean _tripleNotEquals_1 = (_manifest != null);
if (_tripleNotEquals_1) {
Set<String> _exportedPackages = this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages();
String _packageName = this.getQuickfixProviderClass(this.getGrammar()).getPackageName();
_exportedPackages.add(_packageName);
}
PluginXmlAccess _pluginXml = this.getProjectConfig().getEclipsePlugin().getPluginXml();
boolean _tripleNotEquals_2 = (_pluginXml != null);
if (_tripleNotEquals_2) {
this.addRegistrationToPluginXml();
}
} else {
IBundleProjectConfig _eclipsePlugin_1 = this.getProjectConfig().getEclipsePlugin();
IXtextGeneratorFileSystemAccess _srcGen = null;
if (_eclipsePlugin_1 != null) {
_srcGen = _eclipsePlugin_1.getSrcGen();
}
boolean _tripleNotEquals_3 = (_srcGen != null);
if (_tripleNotEquals_3) {
this.generateGenQuickfixProvider();
}
ManifestAccess _manifest_1 = this.getProjectConfig().getEclipsePlugin().getManifest();
boolean _tripleNotEquals_4 = (_manifest_1 != null);
if (_tripleNotEquals_4) {
Set<String> _exportedPackages_1 = this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages();
String _packageName_1 = this.getQuickfixProviderClass(this.getGrammar()).getPackageName();
_exportedPackages_1.add(_packageName_1);
}
}
}
use of org.eclipse.xtext.xtext.generator.model.ManifestAccess in project xtext-core by eclipse.
the class ValidatorFragment2 method generate.
@Override
public void generate() {
new GuiceModuleAccess.BindingFactory().addTypeToTypeEagerSingleton(this._validatorNaming.getValidatorClass(this.getGrammar()), this._validatorNaming.getValidatorClass(this.getGrammar())).contributeTo(this.getLanguage().getRuntimeGenModule());
boolean _isGenerateStub = this.isGenerateStub();
if (_isGenerateStub) {
boolean _isGenerateXtendStub = this.isGenerateXtendStub();
if (_isGenerateXtendStub) {
this.generateXtendValidatorStub();
} else {
this.generateJavaValidatorStub();
}
}
this.generateGenValidator().writeTo(this.getProjectConfig().getRuntime().getSrcGen());
ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
boolean _tripleNotEquals = (_manifest != null);
if (_tripleNotEquals) {
Set<String> _exportedPackages = this.getProjectConfig().getRuntime().getManifest().getExportedPackages();
String _packageName = this._validatorNaming.getValidatorClass(this.getGrammar()).getPackageName();
_exportedPackages.add(_packageName);
}
PluginXmlAccess _pluginXml = this.getProjectConfig().getEclipsePlugin().getPluginXml();
boolean _tripleNotEquals_1 = (_pluginXml != null);
if (_tripleNotEquals_1) {
this.contributeEclipsePluginExtensions();
}
}
use of org.eclipse.xtext.xtext.generator.model.ManifestAccess in project xtext-core by eclipse.
the class EMFGeneratorFragment2 method addProjectContributions.
protected void addProjectContributions(final Grammar grammar, final List<EPackage> generatedPackages, final ResourceSet rs) {
PluginXmlAccess _pluginXml = this.getProjectConfig().getRuntime().getPluginXml();
boolean _tripleNotEquals = (_pluginXml != null);
if (_tripleNotEquals) {
List<CharSequence> _entries = this.getProjectConfig().getRuntime().getPluginXml().getEntries();
StringConcatenation _builder = new StringConcatenation();
_builder.append("<extension point=\"org.eclipse.emf.ecore.generated_package\">");
_builder.newLine();
{
for (final EPackage pack : generatedPackages) {
_builder.append("\t");
_builder.append("<package ");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("uri = \"");
String _nsURI = pack.getNsURI();
_builder.append(_nsURI, "\t\t");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t");
_builder.append("class = \"");
String _qualifiedPackageInterfaceName = GenModelUtil2.getGenPackage(pack, rs).getQualifiedPackageInterfaceName();
_builder.append(_qualifiedPackageInterfaceName, "\t\t");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t");
_builder.append("genModel = \"");
String _relativePath = this.getRelativePath(this.getGenModelPath(grammar));
_builder.append(_relativePath, "\t\t");
_builder.append("\" />");
_builder.newLineIfNotEmpty();
}
}
_builder.append("</extension>");
_builder.newLine();
_entries.add(_builder.toString());
}
ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
boolean _tripleNotEquals_1 = (_manifest != null);
if (_tripleNotEquals_1) {
CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntime().getManifest().getRequiredBundles(), "org.eclipse.emf.ecore", "org.eclipse.emf.common");
}
for (final EPackage pack_1 : generatedPackages) {
{
final GenPackage genPackage = GenModelUtil2.getGenPackage(pack_1, rs);
if (((this.getProjectConfig().getRuntime().getManifest() != null) && (this.modelPluginID == null))) {
CollectionExtensions.<String>addAll(this.getProjectConfig().getRuntime().getManifest().getExportedPackages(), genPackage.getInterfacePackageName(), genPackage.getClassPackageName(), genPackage.getUtilitiesPackageName());
}
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("if (!");
_builder.append(EPackage.class);
_builder.append(".Registry.INSTANCE.containsKey(\"");
String _nsURI = pack_1.getNsURI();
_builder.append(_nsURI);
_builder.append("\")) {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(EPackage.class, "\t");
_builder.append(".Registry.INSTANCE.put(\"");
String _nsURI_1 = pack_1.getNsURI();
_builder.append(_nsURI_1, "\t");
_builder.append("\", ");
String _qualifiedPackageInterfaceName = genPackage.getQualifiedPackageInterfaceName();
TypeReference _typeReference = new TypeReference(_qualifiedPackageInterfaceName);
_builder.append(_typeReference, "\t");
_builder.append(".eINSTANCE);");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
}
};
this.getLanguage().getRuntimeGenSetup().getRegistrations().add(_client);
}
}
}
use of org.eclipse.xtext.xtext.generator.model.ManifestAccess in project xtext-core by eclipse.
the class GeneratorFragment2 method generate.
@Override
public void generate() {
boolean _isGenerateStub = this.isGenerateStub();
if (_isGenerateStub) {
new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IGenerator2.class), this.getGeneratorStub(this.getLanguage().getGrammar())).contributeTo(this.getLanguage().getRuntimeGenModule());
ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
boolean _tripleNotEquals = (_manifest != null);
if (_tripleNotEquals) {
Set<String> _requiredBundles = this.getProjectConfig().getRuntime().getManifest().getRequiredBundles();
String _xbaseLibVersionLowerBound = this.getProjectConfig().getRuntime().getXbaseLibVersionLowerBound();
String _plus = ("org.eclipse.xtext.xbase.lib;bundle-version=\"" + _xbaseLibVersionLowerBound);
String _plus_1 = (_plus + "\"");
_requiredBundles.add(_plus_1);
}
boolean _isGenerateXtendStub = this.isGenerateXtendStub();
if (_isGenerateXtendStub) {
this.doGenerateXtendStubFile();
} else {
this.doGenerateJavaStubFile();
}
}
if ((this.isGenerateStub() || this.isGenerateJavaMain())) {
ManifestAccess _manifest_1 = this.getProjectConfig().getRuntime().getManifest();
boolean _tripleNotEquals_1 = (_manifest_1 != null);
if (_tripleNotEquals_1) {
Set<String> _exportedPackages = this.getProjectConfig().getRuntime().getManifest().getExportedPackages();
String _packageName = this.getGeneratorStub(this.getLanguage().getGrammar()).getPackageName();
_exportedPackages.add(_packageName);
}
}
boolean _isGenerateJavaMain = this.isGenerateJavaMain();
if (_isGenerateJavaMain) {
this.doGenerateJavaMain();
}
boolean _isGenerateXtendMain = this.isGenerateXtendMain();
if (_isGenerateXtendMain) {
this.doGenerateXtendMain();
}
boolean _isGenerateMwe = this.isGenerateMwe();
if (_isGenerateMwe) {
this.doGenerateMweFile();
}
this.contributeEclipsePluginGuiceBindings();
ManifestAccess _manifest_2 = this.getProjectConfig().getEclipsePlugin().getManifest();
boolean _tripleNotEquals_2 = (_manifest_2 != null);
if (_tripleNotEquals_2) {
Set<String> _requiredBundles_1 = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles();
_requiredBundles_1.add("org.eclipse.xtext.builder");
}
PluginXmlAccess _pluginXml = this.getProjectConfig().getEclipsePlugin().getPluginXml();
boolean _tripleNotEquals_3 = (_pluginXml != null);
if (_tripleNotEquals_3) {
this.contributeEclipsePluginExtensions();
}
}
Aggregations