mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 16:28:56 +00:00
[415677] Language Specific Compare Viewer title
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
This commit is contained in:
parent
361ac9f799
commit
3d74fa82e3
2 changed files with 26 additions and 4 deletions
|
@ -8,12 +8,14 @@
|
|||
package org.eclipse.xtext.xtext.generator.ui.compare
|
||||
|
||||
import com.google.inject.Inject
|
||||
import com.google.inject.name.Names
|
||||
import org.eclipse.xtend2.lib.StringConcatenationClient
|
||||
import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment
|
||||
import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming
|
||||
import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess
|
||||
import org.eclipse.xtext.xtext.generator.model.TypeReference
|
||||
|
||||
import static extension org.eclipse.xtext.GrammarUtil.*
|
||||
import org.eclipse.xtext.xtext.generator.AbstractXtextGeneratorFragment
|
||||
|
||||
/**
|
||||
* Contributes the registration of compare infrastructure.
|
||||
|
@ -31,12 +33,13 @@ class CompareFragment2 extends AbstractXtextGeneratorFragment {
|
|||
"org.eclipse.compare", "org.eclipse.xtext.ui"
|
||||
]
|
||||
}
|
||||
|
||||
val StringConcatenationClient statement =
|
||||
'''binder.bind(«String».class).annotatedWith(«Names».named(«new TypeReference("org.eclipse.xtext.ui.UIBindings")».COMPARE_VIEWER_TITLE)).toInstance("«grammar.simpleName» Compare");'''
|
||||
new GuiceModuleAccess.BindingFactory()
|
||||
.addTypeToType(
|
||||
new TypeReference("org.eclipse.compare.IViewerCreator"),
|
||||
new TypeReference("org.eclipse.xtext.ui.compare.DefaultViewerCreator")
|
||||
).contributeTo(language.eclipsePluginGenModule);
|
||||
).addConfiguredBinding("CompareViewerTitle", statement).contributeTo(language.eclipsePluginGenModule);
|
||||
|
||||
if (projectConfig.eclipsePlugin?.pluginXml !== null) {
|
||||
projectConfig.eclipsePlugin.pluginXml.entries += '''
|
||||
|
|
|
@ -9,10 +9,12 @@ package org.eclipse.xtext.xtext.generator.ui.compare;
|
|||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.name.Names;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtend2.lib.StringConcatenationClient;
|
||||
import org.eclipse.xtext.GrammarUtil;
|
||||
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
|
||||
import org.eclipse.xtext.xbase.lib.Extension;
|
||||
|
@ -48,10 +50,27 @@ public class CompareFragment2 extends AbstractXtextGeneratorFragment {
|
|||
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).contributeTo(this.getLanguage().getEclipsePluginGenModule());
|
||||
_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) {
|
||||
|
|
Loading…
Reference in a new issue