@Override public Set<Binding> getGuiceBindingsRt(final Grammar grammar) { final StringBuilder cfg = new StringBuilder(); StringConcatenation _builder = new StringConcatenation(); _builder.append("binder.bind("); String _name = IPreferenceValuesProvider.class.getName(); _builder.append(_name); _builder.append(".class)"); cfg.append(_builder); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(".annotatedWith("); String _name_1 = FormatterPreferences.class.getName(); _builder_1.append(_name_1); _builder_1.append(".class)"); cfg.append(_builder_1); StringConcatenation _builder_2 = new StringConcatenation(); _builder_2.append(".to("); String _name_2 = FormatterPreferenceValuesProvider.class.getName(); _builder_2.append(_name_2); _builder_2.append(".class);"); cfg.append(_builder_2); final BindFactory bf = new BindFactory(); bf.addTypeToType(IFormatter2.class.getName(), this.stubGenerator.getStubQualifiedName()); bf.addConfiguredBinding(FormatterPreferences.class.getName(), cfg.toString()); return bf.getBindings(); }
/** Configures the formatter preference value provider */ @Override public void configureFormatterPreferences(Binder binder) { binder .bind(IPreferenceValuesProvider.class) .annotatedWith(FormatterPreferences.class) .to(N4JSSimpleFormattingPreferenceProvider.class); }
@Override public void generate() { boolean _isGenerateStub = this.isGenerateStub(); boolean _not = (!_isGenerateStub); if (_not) { return; } StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("binder.bind("); _builder.append(IPreferenceValuesProvider.class); _builder.append(".class).annotatedWith("); _builder.append(FormatterPreferences.class); _builder.append(".class).to("); _builder.append(FormatterPreferenceValuesProvider.class); _builder.append(".class);"); } }; final StringConcatenationClient statement = _client; new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IFormatter2.class), this.getFormatter2Stub(this.getLanguage().getGrammar())).addConfiguredBinding(FormatterPreferences.class.getSimpleName(), statement).contributeTo(this.getLanguage().getRuntimeGenModule()); new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef("org.eclipse.xtext.ui.editor.formatting.IContentFormatterFactory"), TypeReference.typeRef("org.eclipse.xtext.ui.editor.formatting2.ContentFormatterFactory")).contributeTo(this.getLanguage().getEclipsePluginGenModule()); ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest(); boolean _tripleNotEquals = (_manifest != null); if (_tripleNotEquals) { Set<String> _exportedPackages = this.getProjectConfig().getRuntime().getManifest().getExportedPackages(); String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(this.getGrammar()); String _plus = (_runtimeBasePackage + ".formatting2"); _exportedPackages.add(_plus); } this.doGenerateStubFile(); }
public void configureFormatterPreferences(Binder binder) { binder.bind(IPreferenceValuesProvider.class).annotatedWith(FormatterPreferences.class).to(FormatterPreferenceValuesProvider.class); }