use of org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig in project xtext-core by eclipse.
the class SimpleProjectWizardFragment2 method generate.
@Override
public void generate() {
if ((!this.generate)) {
return;
}
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.ui", "org.eclipse.core.runtime", "org.eclipse.core.resources", "org.eclipse.ui.ide")));
}
GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.wizard.IProjectCreator");
String _projectCreatorClassName = this.getProjectCreatorClassName();
TypeReference _typeReference_1 = new TypeReference(_projectCreatorClassName);
_bindingFactory.addTypeToType(_typeReference, _typeReference_1).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");
_builder.newLine();
_builder.append("\t");
_builder.append("point=\"org.eclipse.ui.newWizards\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<wizard");
_builder.newLine();
_builder.append("\t\t");
_builder.append("category=\"org.eclipse.xtext.projectwiz\"");
_builder.newLine();
_builder.append("\t\t");
_builder.append("class=\"");
TypeReference _eclipsePluginExecutableExtensionFactory = this._xtextGeneratorNaming.getEclipsePluginExecutableExtensionFactory(this.getGrammar());
_builder.append(_eclipsePluginExecutableExtensionFactory, "\t\t");
_builder.append(":");
String _projectWizardClassName = this.getProjectWizardClassName();
_builder.append(_projectWizardClassName, "\t\t");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("id=\"");
String _projectWizardClassName_1 = this.getProjectWizardClassName();
_builder.append(_projectWizardClassName_1, "\t\t");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("name=\"");
String _simpleName = GrammarUtil.getSimpleName(this.getGrammar());
_builder.append(_simpleName, "\t\t");
_builder.append(" Project\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t");
_builder.append("project=\"true\">");
_builder.newLine();
_builder.append("\t");
_builder.append("</wizard>");
_builder.newLine();
_builder.append("</extension>");
_builder.newLine();
_entries.add(_builder.toString());
}
this.generateProjectInfo();
this.generateWizardNewProjectCreationPage();
this.generateNewProjectWizardInitialContents();
this.generateProjectCreator();
this.generateNewProjectWizard();
}
use of org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig in project xtext-core by eclipse.
the class TemplateProjectWizardFragment method generate.
@Override
public void generate() {
if ((!this.generate)) {
return;
}
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.core.runtime", "org.eclipse.core.resources", "org.eclipse.ui", "org.eclipse.ui.ide", "org.eclipse.ui.forms")));
if (this.pluginProject) {
Set<String> _requiredBundles_1 = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles();
Iterables.<String>addAll(_requiredBundles_1, Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("org.eclipse.jdt.core", "org.eclipse.pde.core")));
}
Set<String> _exportedPackages = this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages();
String _eclipsePluginBasePackage = this._xtextGeneratorNaming.getEclipsePluginBasePackage(this.getGrammar());
String _plus = (_eclipsePluginBasePackage + ".wizard");
Iterables.<String>addAll(_exportedPackages, Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(_plus)));
}
GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.wizard.IProjectCreator");
TypeReference _typeReference_1 = new TypeReference("org.eclipse.xtext.ui.wizard.template.DefaultTemplateProjectCreator");
_bindingFactory.addTypeToType(_typeReference, _typeReference_1).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");
_builder.newLine();
_builder.append("\t");
_builder.append("point=\"org.eclipse.ui.newWizards\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<category id=\"");
String _eclipsePluginBasePackage_1 = this._xtextGeneratorNaming.getEclipsePluginBasePackage(this.getGrammar());
_builder.append(_eclipsePluginBasePackage_1, "\t");
_builder.append(".category\" name=\"");
String _simpleName = GrammarUtil.getSimpleName(this.getGrammar());
_builder.append(_simpleName, "\t");
_builder.append("\">");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("</category>");
_builder.newLine();
_builder.append("\t");
_builder.append("<wizard");
_builder.newLine();
_builder.append("\t\t");
_builder.append("category=\"");
String _eclipsePluginBasePackage_2 = this._xtextGeneratorNaming.getEclipsePluginBasePackage(this.getGrammar());
_builder.append(_eclipsePluginBasePackage_2, "\t\t");
_builder.append(".category\"");
_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.wizard.template.TemplateNewProjectWizard\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("id=\"");
String _projectWizardClassName = this.getProjectWizardClassName();
_builder.append(_projectWizardClassName, "\t\t");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("name=\"");
String _simpleName_1 = GrammarUtil.getSimpleName(this.getGrammar());
_builder.append(_simpleName_1, "\t\t");
_builder.append(" Project\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("icon=\"icons/new_");
String _simpleName_2 = GrammarUtil.getSimpleName(this.getGrammar());
_builder.append(_simpleName_2, "\t\t");
_builder.append("_proj.gif\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("project=\"true\">");
_builder.newLine();
_builder.append("\t");
_builder.append("</wizard>");
_builder.newLine();
_builder.append("</extension>");
_builder.newLine();
_builder.append("<extension");
_builder.newLine();
_builder.append(" ");
_builder.append("point=\"org.eclipse.xtext.ui.projectTemplate\">");
_builder.newLine();
_builder.append(" ");
_builder.append("<projectTemplateProvider");
_builder.newLine();
_builder.append(" ");
_builder.append("class=\"");
String _projectTemplateProviderClassName = this.getProjectTemplateProviderClassName();
_builder.append(_projectTemplateProviderClassName, " ");
_builder.append("\"");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("grammarName=\"");
String _name = this.getGrammar().getName();
_builder.append(_name, " ");
_builder.append("\">");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("</projectTemplateProvider>");
_builder.newLine();
_builder.append("</extension>");
_builder.newLine();
_entries.add(_builder.toString());
}
this.generateProjectTemplateProvider();
this.generateDefaultIcons();
}
use of org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig in project xtext-core by eclipse.
the class RefactorElementNameFragment2 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();
_requiredBundles.add("org.eclipse.xtext.ui");
}
final GuiceModuleAccess.BindingFactory uiBindings = new GuiceModuleAccess.BindingFactory();
String _join = IterableExtensions.join(TypeReference.typeRef("org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreInitializer").getSimpleNames(), ".");
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("binder.bind(");
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreInitializer");
_builder.append(_typeRef);
_builder.append(".class)");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(".annotatedWith(");
_builder.append(Names.class, "\t");
_builder.append(".named(\"RefactoringPreferences\"))");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(".to(");
TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.refactoring.ui", "RefactoringPreferences.Initializer");
_builder.append(_typeReference, "\t");
_builder.append(".class);");
_builder.newLineIfNotEmpty();
}
};
uiBindings.addConfiguredBinding(_join, _client);
boolean _isUseChangeSerializer = this.isUseChangeSerializer(this.getGrammar());
if (_isUseChangeSerializer) {
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ide.refactoring.IRenameStrategy2");
TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ide.refactoring", "IRenameStrategy2.DefaultImpl");
uiBindings.addTypeToType(_typeRef, _typeReference).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.AbstractRenameProcessor"), TypeReference.typeRef("org.eclipse.xtext.ui.refactoring2.rename.RenameElementProcessor2")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.ILinkedPositionGroupCalculator"), TypeReference.typeRef("org.eclipse.xtext.ui.refactoring2.rename.DefaultLinkedPositionGroupCalculator2"));
} else {
uiBindings.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameStrategy"), TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultRenameStrategy")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IReferenceUpdater"), TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultReferenceUpdater"));
}
boolean _isUseJdtRefactoring = this.isUseJdtRefactoring(this.getGrammar());
if (_isUseJdtRefactoring) {
GuiceModuleAccess.BindingFactory _addTypeToType = uiBindings.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.ui.IRenameContextFactory"), TypeReference.typeRef("org.eclipse.xtext.common.types.ui.refactoring.JdtRefactoringContextFactory")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameRefactoringProvider"), TypeReference.typeRef("org.eclipse.xtext.common.types.ui.refactoring.JvmRenameRefactoringProvider"));
TypeReference _typeReference_1 = new TypeReference("org.eclipse.xtext.ui.refactoring.ui", "IRenameSupport.Factory");
TypeReference _typeReference_2 = new TypeReference("org.eclipse.xtext.common.types.ui.refactoring", "JdtRenameSupport.Factory");
GuiceModuleAccess.BindingFactory _addTypeToType_1 = _addTypeToType.addTypeToType(_typeReference_1, _typeReference_2);
TypeReference _typeReference_3 = new TypeReference("org.eclipse.xtext.ui.refactoring", "IRenameStrategy.Provider");
TypeReference _typeReference_4 = new TypeReference("org.eclipse.xtext.common.types.ui.refactoring.participant", "JvmMemberRenameStrategy.Provider");
GuiceModuleAccess.BindingFactory _addTypeToType_2 = _addTypeToType_1.addTypeToType(_typeReference_3, _typeReference_4);
StringConcatenationClient _client_1 = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("binder.bind(");
TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.refactoring", "IRenameStrategy.Provider");
_builder.append(_typeReference);
_builder.append(".class).annotatedWith(");
TypeReference _typeReference_1 = new TypeReference("org.eclipse.xtext.common.types.ui.refactoring.participant", "JvmMemberRenameStrategy.Provider.Delegate");
_builder.append(_typeReference_1);
_builder.append(".class).to(");
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultRenameStrategyProvider");
_builder.append(_typeRef);
_builder.append(".class);");
_builder.newLineIfNotEmpty();
}
};
_addTypeToType_2.addConfiguredBinding("JvmMemberRenameStrategy.Provider.Delegate", _client_1);
} else {
GuiceModuleAccess.BindingFactory _addTypeToType_3 = uiBindings.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.IRenameRefactoringProvider"), TypeReference.typeRef("org.eclipse.xtext.ui.refactoring.impl.DefaultRenameRefactoringProvider"));
TypeReference _typeReference_5 = new TypeReference("org.eclipse.xtext.ui.refactoring.ui", "IRenameSupport.Factory");
TypeReference _typeReference_6 = new TypeReference("org.eclipse.xtext.ui.refactoring.ui", "DefaultRenameSupport.Factory");
_addTypeToType_3.addTypeToType(_typeReference_5, _typeReference_6);
}
uiBindings.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("<!-- Rename Refactoring -->");
_builder.newLine();
_builder.append("<extension 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.refactoring.ui.DefaultRenameElementHandler\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("commandId=\"org.eclipse.xtext.ui.refactoring.RenameElement\">");
_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 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.edit\">");
_builder.newLine();
_builder.append("\t\t");
_builder.append("<command commandId=\"org.eclipse.xtext.ui.refactoring.RenameElement\"");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("style=\"push\">");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("<visibleWhen checkEnabled=\"false\">");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("<reference");
_builder.newLine();
_builder.append("\t\t\t\t\t");
_builder.append("definitionId=\"");
String _name_1 = this.getGrammar().getName();
_builder.append(_name_1, "\t\t\t\t\t");
_builder.append(".Editor.opened\">");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t\t");
_builder.append("</reference>");
_builder.newLine();
_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();
_builder.append("<extension point=\"org.eclipse.ui.preferencePages\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<page");
_builder.newLine();
_builder.append("\t\t");
_builder.append("category=\"");
String _name_2 = this.getGrammar().getName();
_builder.append(_name_2, "\t\t");
_builder.append("\"");
_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.refactoring.ui.RefactoringPreferencePage\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("id=\"");
String _name_3 = this.getGrammar().getName();
_builder.append(_name_3, "\t\t");
_builder.append(".refactoring\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("name=\"Refactoring\">");
_builder.newLine();
_builder.append("\t\t");
_builder.append("<keywordReference id=\"");
String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(this.getGrammar());
String _plus = (_runtimeBasePackage + ".ui.keyword_");
String _simpleName = GrammarUtil.getSimpleName(this.getGrammar());
String _plus_1 = (_plus + _simpleName);
_builder.append(_plus_1, "\t\t");
_builder.append("\"/>");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("</page>");
_builder.newLine();
_builder.append("</extension>");
_builder.newLine();
_entries.add(_builder.toString());
}
boolean _isEnabled = this.getProjectConfig().getGenericIde().isEnabled();
if (_isEnabled) {
final GuiceModuleAccess.BindingFactory ideBindings = new GuiceModuleAccess.BindingFactory();
ideBindings.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ide.server.rename.IRenameService"), TypeReference.typeRef("org.eclipse.xtext.ide.server.rename.RenameService"));
TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.ide.refactoring.IRenameStrategy2");
TypeReference _typeReference_7 = new TypeReference("org.eclipse.xtext.ide.refactoring", "IRenameStrategy2.DefaultImpl");
ideBindings.addTypeToType(_typeRef_1, _typeReference_7);
ideBindings.contributeTo(this.getLanguage().getIdeGenModule());
}
}
use of org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig in project xtext-core by eclipse.
the class CodetemplatesGeneratorFragment2 method generate.
@Override
public void generate() {
IBundleProjectConfig _eclipsePlugin = this.getProjectConfig().getEclipsePlugin();
ManifestAccess _manifest = null;
if (_eclipsePlugin != null) {
_manifest = _eclipsePlugin.getManifest();
}
Set<String> _requiredBundles = null;
if (_manifest != null) {
_requiredBundles = _manifest.getRequiredBundles();
}
if (_requiredBundles != null) {
_requiredBundles.addAll(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("org.eclipse.xtext.ui", "org.eclipse.xtext.ui.codetemplates.ui")));
}
GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.preferences.TemplatesLanguageConfiguration");
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.AccessibleCodetemplatesActivator");
_builder.append(_typeRef);
_builder.append(".getTemplatesLanguageConfigurationProvider()");
}
};
GuiceModuleAccess.BindingFactory _addTypeToProviderInstance = _bindingFactory.addTypeToProviderInstance(_typeRef, _client);
TypeReference _typeRef_1 = TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistry");
StringConcatenationClient _client_1 = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.AccessibleCodetemplatesActivator");
_builder.append(_typeRef);
_builder.append(".getLanguageRegistry()");
}
};
_addTypeToProviderInstance.addTypeToProviderInstance(_typeRef_1, _client_1).addTypeToTypeEagerSingleton(TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistrar"), TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistrar")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.templates.XtextTemplatePreferencePage"), TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.preferences.AdvancedTemplatesPreferencePage")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ide.editor.partialEditing.IPartialEditingContentAssistParser"), this.getPartialContentAssistParserClass(this.getGrammar())).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.partialEditing.IPartialEditingContentAssistContextFactory"), TypeReference.typeRef("org.eclipse.xtext.ui.codetemplates.ui.partialEditing.PartialEditingContentAssistContextFactory")).contributeTo(this.getLanguage().getEclipsePluginGenModule());
IBundleProjectConfig _genericIde = this.getProjectConfig().getGenericIde();
IXtextGeneratorFileSystemAccess _srcGen = null;
if (_genericIde != null) {
_srcGen = _genericIde.getSrcGen();
}
boolean _tripleNotEquals = (_srcGen != null);
if (_tripleNotEquals) {
GeneratedJavaFileAccess _createGeneratedJavaFile = this.fileAccessFactory.createGeneratedJavaFile(this.getPartialContentAssistParserClass(this.getGrammar()));
final Procedure1<GeneratedJavaFileAccess> _function = (GeneratedJavaFileAccess it) -> {
it.setContent(this.getGenPartialContentAssistParser());
it.writeTo(this.getProjectConfig().getGenericIde().getSrcGen());
};
ObjectExtensions.<GeneratedJavaFileAccess>operator_doubleArrow(_createGeneratedJavaFile, _function);
}
}
use of org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig in project xtext-core by eclipse.
the class ResourceFactoryFragment2 method generate.
@Override
public void generate() {
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append(IResourceFactory.class);
_builder.append(" resourceFactory = injector.getInstance(");
_builder.append(IResourceFactory.class);
_builder.append(".class);");
_builder.newLineIfNotEmpty();
_builder.append(IResourceServiceProvider.class);
_builder.append(" serviceProvider = injector.getInstance(");
_builder.append(IResourceServiceProvider.class);
_builder.append(".class);");
_builder.newLineIfNotEmpty();
_builder.newLine();
{
List<String> _fileExtensions = ResourceFactoryFragment2.this.getLanguage().getFileExtensions();
for (final String fileExtension : _fileExtensions) {
_builder.append(Resource.class);
_builder.append(".Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(\"");
_builder.append(fileExtension);
_builder.append("\", resourceFactory);");
_builder.newLineIfNotEmpty();
_builder.append(IResourceServiceProvider.class);
_builder.append(".Registry.INSTANCE.getExtensionToFactoryMap().put(\"");
_builder.append(fileExtension);
_builder.append("\", serviceProvider);");
_builder.newLineIfNotEmpty();
}
}
}
};
this.getLanguage().getRuntimeGenSetup().getRegistrations().add(_client);
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("<!-- adding resource factories -->");
_builder.newLine();
{
List<String> _fileExtensions = this.getLanguage().getFileExtensions();
for (final String fileExtension : _fileExtensions) {
_builder.append("<extension");
_builder.newLine();
_builder.append("\t");
_builder.append("point=\"org.eclipse.emf.ecore.extension_parser\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<parser");
_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.resource.IResourceFactory\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("type=\"");
_builder.append(fileExtension, "\t\t");
_builder.append("\">");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("</parser>");
_builder.newLine();
_builder.append("</extension>");
_builder.newLine();
_builder.append("<extension point=\"org.eclipse.xtext.extension_resourceServiceProvider\">");
_builder.newLine();
_builder.append("\t");
_builder.append("<resourceServiceProvider");
_builder.newLine();
_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.resource.IResourceUIServiceProvider\"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("uriExtension=\"");
_builder.append(fileExtension, "\t\t");
_builder.append("\">");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("</resourceServiceProvider>");
_builder.newLine();
_builder.append("</extension>");
_builder.newLine();
}
}
_entries.add(_builder.toString());
}
}
Aggregations