use of org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig 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.project.IBundleProjectConfig in project xtext-core by eclipse.
the class TaskTagPreferencePageFragment2 method generate.
@Override
public void generate() {
final GuiceModuleAccess.BindingFactory rtBindings = new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef("org.eclipse.xtext.tasks.ITaskTagProvider"), TypeReference.typeRef("org.eclipse.xtext.tasks.PreferenceTaskTagProvider"));
rtBindings.contributeTo(this.getLanguage().getRuntimeGenModule());
GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("binder.bind(org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreInitializer.class)");
_builder.newLine();
_builder.append(".annotatedWith(com.google.inject.name.Names.named(\"taskTagPreferenceInitializer\"))");
_builder.newLine();
_builder.append(".to(org.eclipse.xtext.ui.tasks.preferences.TaskTagPreferenceInitializer.class);");
_builder.newLine();
}
};
final GuiceModuleAccess.BindingFactory eclipseBindings = _bindingFactory.addConfiguredBinding("TaskTagPreferenceStoreInitializer", _client);
eclipseBindings.contributeTo(this.getLanguage().getEclipsePluginGenModule());
IBundleProjectConfig _eclipsePlugin = this.getProjectConfig().getEclipsePlugin();
PluginXmlAccess _pluginXml = null;
if (_eclipsePlugin != null) {
_pluginXml = _eclipsePlugin.getPluginXml();
}
boolean _tripleNotEquals = (_pluginXml != null);
if (_tripleNotEquals) {
List<CharSequence> _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries();
StringConcatenation _builder = new StringConcatenation();
_builder.append("<!-- task preference page for ");
String _name = this.grammar.getName();
_builder.append(_name);
_builder.append(" -->");
_builder.newLineIfNotEmpty();
_builder.append("<extension");
_builder.newLine();
_builder.append("point=\"org.eclipse.ui.preferencePages\">");
_builder.newLine();
_builder.append("<page");
_builder.newLine();
_builder.append("\t");
_builder.append("category=\"");
String _name_1 = this.grammar.getName();
_builder.append(_name_1, "\t");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("class=\"");
TypeReference _eclipsePluginExecutableExtensionFactory = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.grammar);
_builder.append(_eclipsePluginExecutableExtensionFactory, "\t");
_builder.append(":org.eclipse.xtext.ui.tasks.preferences.TaskTagPreferencePage\"");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("id=\"");
String _name_2 = this.grammar.getName();
_builder.append(_name_2, "\t");
_builder.append(".task.preferencePage\"");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("name=\"Task Tags\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<keywordReference id=\"");
String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(this.grammar);
String _plus = (_runtimeBasePackage + ".ui.keyword_");
String _simpleName = GrammarUtil.getSimpleName(this.grammar);
String _plus_1 = (_plus + _simpleName);
_builder.append(_plus_1, "\t");
_builder.append("\"/>");
_builder.newLineIfNotEmpty();
_builder.append("</page>");
_builder.newLine();
_builder.append("</extension>");
_builder.newLine();
_builder.append("<extension");
_builder.newLine();
_builder.append("point=\"org.eclipse.ui.propertyPages\">");
_builder.newLine();
_builder.append("<page");
_builder.newLine();
_builder.append("\t");
_builder.append("category=\"");
String _name_3 = this.grammar.getName();
_builder.append(_name_3, "\t");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("class=\"");
TypeReference _eclipsePluginExecutableExtensionFactory_1 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.grammar);
_builder.append(_eclipsePluginExecutableExtensionFactory_1, "\t");
_builder.append(":org.eclipse.xtext.ui.tasks.preferences.TaskTagPreferencePage\"");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("id=\"");
String _name_4 = this.grammar.getName();
_builder.append(_name_4, "\t");
_builder.append(".task.propertyPage\"");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("name=\"Task Tags\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<keywordReference id=\"");
String _runtimeBasePackage_1 = this._xtextGeneratorNaming.getRuntimeBasePackage(this.grammar);
String _plus_2 = (_runtimeBasePackage_1 + ".ui.keyword_");
String _simpleName_1 = GrammarUtil.getSimpleName(this.grammar);
String _plus_3 = (_plus_2 + _simpleName_1);
_builder.append(_plus_3, "\t");
_builder.append("\"/>");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("<enabledWhen>");
_builder.newLine();
_builder.append("\t\t");
_builder.append("<adapt type=\"org.eclipse.core.resources.IProject\"/>");
_builder.newLine();
_builder.append("\t");
_builder.append("</enabledWhen>");
_builder.newLine();
_builder.append("\t");
_builder.append("<filter name=\"projectNature\" value=\"org.eclipse.xtext.ui.shared.xtextNature\"/>");
_builder.newLine();
_builder.append("</page>");
_builder.newLine();
_builder.append("</extension>");
_builder.newLine();
_entries.add(_builder.toString());
}
}
use of org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig in project xtext-core by eclipse.
the class CompareFragment2 method generate.
@Override
public void generate() {
IBundleProjectConfig _eclipsePlugin = this.getProjectConfig().getEclipsePlugin();
ManifestAccess _manifest = null;
if (_eclipsePlugin != null) {
_manifest = _eclipsePlugin.getManifest();
}
boolean _tripleNotEquals = (_manifest != null);
if (_tripleNotEquals) {
Set<String> _requiredBundles = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles();
Iterables.<String>addAll(_requiredBundles, Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("org.eclipse.compare", "org.eclipse.xtext.ui")));
}
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("binder.bind(");
_builder.append(String.class);
_builder.append(".class).annotatedWith(");
_builder.append(Names.class);
_builder.append(".named(");
TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.UIBindings");
_builder.append(_typeReference);
_builder.append(".COMPARE_VIEWER_TITLE)).toInstance(\"");
String _simpleName = GrammarUtil.getSimpleName(CompareFragment2.this.getGrammar());
_builder.append(_simpleName);
_builder.append(" Compare\");");
}
};
final StringConcatenationClient statement = _client;
GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
TypeReference _typeReference = new TypeReference("org.eclipse.compare.IViewerCreator");
TypeReference _typeReference_1 = new TypeReference("org.eclipse.xtext.ui.compare.DefaultViewerCreator");
_bindingFactory.addTypeToType(_typeReference, _typeReference_1).addConfiguredBinding("CompareViewerTitle", statement).contributeTo(this.getLanguage().getEclipsePluginGenModule());
IBundleProjectConfig _eclipsePlugin_1 = this.getProjectConfig().getEclipsePlugin();
PluginXmlAccess _pluginXml = null;
if (_eclipsePlugin_1 != null) {
_pluginXml = _eclipsePlugin_1.getPluginXml();
}
boolean _tripleNotEquals_1 = (_pluginXml != null);
if (_tripleNotEquals_1) {
List<CharSequence> _entries = this.getProjectConfig().getEclipsePlugin().getPluginXml().getEntries();
StringConcatenation _builder = new StringConcatenation();
_builder.append("<extension point=\"org.eclipse.compare.contentViewers\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<viewer id=\"");
String _name = this.getGrammar().getName();
_builder.append(_name, "\t");
_builder.append(".compare.contentViewers\"");
_builder.newLineIfNotEmpty();
_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.compare.InjectableViewerCreator\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("extensions=\"");
String _join = IterableExtensions.join(this.getLanguage().getFileExtensions(), ",");
_builder.append(_join, "\t\t");
_builder.append("\">");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("</viewer>");
_builder.newLine();
_builder.append("\t");
_builder.append("<contentTypeBinding");
_builder.newLine();
_builder.append("\t\t");
_builder.append("contentTypeId=\"");
String _name_1 = this.getGrammar().getName();
_builder.append(_name_1, "\t\t");
_builder.append(".contenttype\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("contentViewerId=\"");
String _name_2 = this.getGrammar().getName();
_builder.append(_name_2, "\t\t");
_builder.append(".compare.contentViewers\" />");
_builder.newLineIfNotEmpty();
_builder.append("</extension>");
_builder.newLine();
_builder.append("<extension point=\"org.eclipse.compare.contentMergeViewers\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<viewer id=\"");
String _name_3 = this.getGrammar().getName();
_builder.append(_name_3, "\t");
_builder.append(".compare.contentMergeViewers\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("class=\"");
TypeReference _eclipsePluginExecutableExtensionFactory_1 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar());
_builder.append(_eclipsePluginExecutableExtensionFactory_1, "\t\t");
_builder.append(":org.eclipse.xtext.ui.compare.InjectableViewerCreator\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("extensions=\"");
String _join_1 = IterableExtensions.join(this.getLanguage().getFileExtensions(), ",");
_builder.append(_join_1, "\t\t");
_builder.append("\" label=\"");
String _simpleName = GrammarUtil.getSimpleName(this.getGrammar());
_builder.append(_simpleName, "\t\t");
_builder.append(" Compare\">");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("</viewer>");
_builder.newLine();
_builder.append("\t");
_builder.append("<contentTypeBinding");
_builder.newLine();
_builder.append("\t\t");
_builder.append("contentTypeId=\"");
String _name_4 = this.getGrammar().getName();
_builder.append(_name_4, "\t\t");
_builder.append(".contenttype\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("contentMergeViewerId=\"");
String _name_5 = this.getGrammar().getName();
_builder.append(_name_5, "\t\t");
_builder.append(".compare.contentMergeViewers\" />");
_builder.newLineIfNotEmpty();
_builder.append("</extension>");
_builder.newLine();
_builder.append("<extension point=\"org.eclipse.ui.editors.documentProviders\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<provider id=\"");
String _name_6 = this.getGrammar().getName();
_builder.append(_name_6, "\t");
_builder.append(".editors.documentProviders\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("class=\"");
TypeReference _eclipsePluginExecutableExtensionFactory_2 = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar());
_builder.append(_eclipsePluginExecutableExtensionFactory_2, "\t\t");
_builder.append(":org.eclipse.xtext.ui.editor.model.XtextDocumentProvider\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("extensions=\"");
String _join_2 = IterableExtensions.join(this.getLanguage().getFileExtensions(), ",");
_builder.append(_join_2, "\t\t");
_builder.append("\">");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("</provider>");
_builder.newLine();
_builder.append("</extension>");
_builder.newLine();
_builder.append("<extension point=\"org.eclipse.team.core.fileTypes\">");
_builder.newLine();
{
List<String> _fileExtensions = this.getLanguage().getFileExtensions();
for (final String modelFileExtension : _fileExtensions) {
_builder.append("\t");
_builder.append("<fileTypes");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("extension=\"");
_builder.append(modelFileExtension, "\t\t");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t");
_builder.append("type=\"text\">");
_builder.newLine();
_builder.append("\t");
_builder.append("</fileTypes>");
_builder.newLine();
}
}
_builder.append("</extension>");
_builder.newLine();
_entries.add(_builder.toString());
}
}
Aggregations