use of org.eclipse.xtext.generator.BindFactory in project dsl-devkit by dsldevkit.
the class ModelInferenceFragment method getGuiceBindingsRt.
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
BindFactory factory = new BindFactory();
if (generateModelInference) {
factory.addTypeToTypeSingleton(IInferredModelAssociations.class.getName(), InferredModelAssociator.class.getName());
factory.addTypeToTypeSingleton(IInferredModelAssociator.class.getName(), InferredModelAssociator.class.getName());
factory.addTypeToTypeSingleton(IDerivedStateComputer.class.getName(), InferredModelAssociator.class.getName());
}
return factory.getBindings();
}
use of org.eclipse.xtext.generator.BindFactory in project dsl-devkit by dsldevkit.
the class BuilderIntegrationFragment method getGuiceBindingsUi.
/**
* {@inheritDoc}
*/
@Override
public Set<Binding> getGuiceBindingsUi(final Grammar grammar) {
final Set<Binding> bindings = super.getGuiceBindingsUi(grammar);
final BindFactory factory = new BindFactory();
factory.addConfiguredBinding(IResourceDescriptions.class.getName() + "BuilderScope", "binder.bind(" + IResourceDescriptions.class.getName() + ".class" + ").annotatedWith(com.google.inject.name.Names.named(" + ResourceDescriptionsProvider.class.getName() + ".NAMED_BUILDER_SCOPE)).to(" + "com.avaloq.tools.ddk.xtext.builder.CurrentDescriptions2.ResourceSetAware.class)");
final Set<Binding> result = factory.getBindings();
result.addAll(bindings);
return result;
}
use of org.eclipse.xtext.generator.BindFactory in project dsl-devkit by dsldevkit.
the class BuilderIntegrationFragment method getGuiceBindingsRt.
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
final Set<Binding> bindings = super.getGuiceBindingsRt(grammar);
final BindFactory factory = new BindFactory();
factory.addTypeToType(IContainer.Manager.class.getName(), "com.avaloq.tools.ddk.xtext.builder.CachingStateBasedContainerManager");
factory.addTypeToType(LazyLinkingResource.class.getName(), LazyLinkingResource2.class.getName());
factory.addTypeToType(LazyURIEncoder.class.getName(), FastLazyURIEncoder.class.getName());
final Set<Binding> result = factory.getBindings();
result.addAll(bindings);
return result;
}
use of org.eclipse.xtext.generator.BindFactory in project dsl-devkit by dsldevkit.
the class ScopingFragment method getGuiceBindingsRt.
/**
* {@inheritDoc}
*/
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
final BindFactory bindFactory = new BindFactory();
final String prefix = GrammarUtil.getNamespace(grammar) + ".scoping." + GrammarUtil.getName(grammar);
bindFactory.addTypeToType(IScopeProvider.class.getName(), prefix + "ScopeProvider");
bindFactory.addTypeToType(IScopeNameProvider.class.getName(), prefix + "ScopeNameProvider");
bindFactory.addTypeToType(ILinkingService.class.getName(), "com.avaloq.tools.ddk.xtext.linking.LinkingService");
return bindFactory.getBindings();
}
use of org.eclipse.xtext.generator.BindFactory in project xtext-eclipse by eclipse.
the class IdeaPluginGenerator method generate.
@Override
public void generate(final Grammar grammar, final Xtend2ExecutionContext ctx) {
this._xtextIDEAGeneratorExtensions.installOutlets(ctx, this.ideaProjectPath, this.encoding, this.getNaming().getLineDelimiter());
String outlet_src_gen = this._xtextIDEAGeneratorExtensions.getSrcGenOutlet(ctx).getName();
String _xifexpression = null;
if (this.srcGenOnly) {
_xifexpression = outlet_src_gen;
} else {
_xifexpression = this._xtextIDEAGeneratorExtensions.getSrcOutlet(ctx).getName();
}
String outlet_src = _xifexpression;
final BindFactory bindFactory = new BindFactory();
bindFactory.addTypeToType("org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider", this._ideaPluginClassNames.getAntlrTokenFileProvider(grammar));
bindFactory.addTypeToType("org.eclipse.xtext.parser.antlr.Lexer", this._ideaPluginClassNames.getPsiInternalLexerName(grammar));
String _psiInternalLexerName = this._ideaPluginClassNames.getPsiInternalLexerName(grammar);
String _plus = (((("binder.bind(org.eclipse.xtext.parser.antlr.Lexer.class)" + ".annotatedWith(com.google.inject.name.Names.named(") + "org.eclipse.xtext.parser.antlr.LexerBindings.RUNTIME") + ")).to(") + _psiInternalLexerName);
String _plus_1 = (_plus + ".class)");
bindFactory.addConfiguredBinding("RuntimeLexer", _plus_1);
bindFactory.addTypeToType("com.intellij.lang.PsiParser", this._ideaPluginClassNames.getPsiParserName(grammar));
bindFactory.addTypeToType("org.eclipse.xtext.idea.parser.TokenTypeProvider", this._ideaPluginClassNames.getTokenTypeProviderName(grammar));
bindFactory.addTypeToType("com.intellij.lang.ParserDefinition", this._ideaPluginClassNames.getParserDefinitionName(grammar));
bindFactory.addTypeToTypeSingleton("org.eclipse.xtext.idea.lang.IElementTypeProvider", this._ideaPluginClassNames.getElementTypeProviderName(grammar));
bindFactory.addTypeToType("org.eclipse.xtext.idea.facet.AbstractFacetConfiguration", this._ideaPluginClassNames.getFacetConfiguration(grammar));
String _facetTypeName = this._ideaPluginClassNames.getFacetTypeName(grammar);
String _plus_2 = (_facetTypeName + ".TYPEID");
bindFactory.addTypeToInstance("com.intellij.facet.FacetTypeId", _plus_2);
boolean _doesUseXbase = XbaseGeneratorFragment.doesUseXbase(grammar);
if (_doesUseXbase) {
bindFactory.addTypeToType("org.eclipse.xtext.common.types.xtext.AbstractTypeScopeProvider", "org.eclipse.xtext.idea.common.types.StubBasedTypeScopeProvider");
bindFactory.addTypeToType("org.eclipse.xtext.xbase.typesystem.internal.IFeatureScopeTracker.Provider", "org.eclipse.xtext.xbase.typesystem.internal.OptimizingFeatureScopeTrackerProvider");
bindFactory.addConfiguredBinding("LanguageSpecificPsiModelAssociations", (("binder.bind(org.eclipse.xtext.psi.IPsiModelAssociations.class)." + "annotatedWith(org.eclipse.xtext.service.LanguageSpecific.class).") + "to(org.eclipse.xtext.idea.common.types.DerivedMemberAwarePsiModelAssociations.class)"));
bindFactory.addTypeToType("org.eclipse.xtext.idea.highlighting.IHighlightingConfiguration", "org.eclipse.xtext.xbase.idea.highlighting.XbaseHighlightingConfiguration");
bindFactory.addTypeToType("org.eclipse.xtext.idea.formatting.BlockFactory", "org.eclipse.xtext.xbase.idea.formatting.XbaseBlockFactory");
bindFactory.addTypeToType("org.eclipse.xtext.idea.formatting.ChildAttributesProvider", "org.eclipse.xtext.xbase.idea.formatting.XbaseChildAttributesProvider");
bindFactory.addTypeToType("org.eclipse.xtext.ide.editor.bracketmatching.IBracePairProvider", "org.eclipse.xtext.xbase.idea.bracketmatching.XbaseBracePairProvider");
bindFactory.addTypeToType("org.eclipse.xtext.idea.findusages.IReferenceSearcher", "org.eclipse.xtext.xbase.idea.findusages.JvmElementAwareReferenceSearcher");
bindFactory.addTypeToType("org.eclipse.xtext.xbase.compiler.IGeneratorConfigProvider", "org.eclipse.xtext.xbase.idea.facet.XbaseGeneratorConfigProvider");
bindFactory.addTypeToType("org.eclipse.xtext.idea.findusages.WordsScannerProvider", "org.eclipse.xtext.xbase.idea.findusages.XbaseWordsScanner.XbaseWordsScannerProvider");
}
final Set<Binding> bindings = bindFactory.getBindings();
ctx.writeFile(outlet_src, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getStandaloneSetupIdea(grammar)), this.compileStandaloneSetup(grammar));
ctx.writeFile(outlet_src, this._ideaPluginClassNames.toXtendPath(this._ideaPluginClassNames.getIdeaSetup(grammar)), this.compileIdeaSetup(grammar));
ctx.writeFile(outlet_src, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getIdeaModuleName(grammar)), this.compileIdeaModule(grammar));
ctx.writeFile(outlet_src, this._ideaPluginClassNames.toXtendPath(this._ideaPluginClassNames.getCompletionContributor(grammar)), this.compileCompletionContributor(grammar));
StringConcatenation _builder = new StringConcatenation();
_builder.append("META-INF/services/");
String _name = ISetup.class.getName();
_builder.append(_name);
ctx.writeFile(outlet_src_gen, _builder.toString(), this.compileServicesISetup(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getAbstractCompletionContributor(grammar)), this.compileAbstractCompletionContributor(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getLanguageName(grammar)), this.compileLanguage(grammar));
ctx.writeFile(outlet_src, this._ideaPluginClassNames.toXtendPath(this._ideaPluginClassNames.getFileTypeName(grammar)), this.compileFileType(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getAbstractFileTypeName(grammar)), this.compileAbstractFileType(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getFileTypeFactoryName(grammar)), this.compileFileTypeFactory(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getFileImplName(grammar)), this.compileFileImpl(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getTokenTypeProviderName(grammar)), this.compileTokenTypeProvider(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getElementTypeProviderName(grammar)), this.compileElementTypeProvider(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getParserDefinitionName(grammar)), this.compileParserDefinition(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getSyntaxHighlighterFactoryName(grammar)), this.compileSyntaxHighlighterFactory(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getSemanticHighlightVisitorName(grammar)), this.compileSemanticHighlightVisitor(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getAbstractIdeaModuleName(grammar)), this.compileGuiceModuleIdeaGenerated(grammar, bindings));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getExtensionFactoryName(grammar)), this.compileExtensionFactory(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getCodeBlockModificationListenerName(grammar)), this.compileCodeBlockModificationListener(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getPsiParserName(grammar)), this.compilePsiParser(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getAntlrTokenFileProvider(grammar)), this.compileAntlrTokenFileProvider(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getPomDeclarationSearcherName(grammar)), this.compilePomDeclarationSearcher(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getFacetTypeName(grammar)), this.compileFacetType(grammar));
ctx.writeFile(outlet_src, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.getFacetConfiguration(grammar)), this.compileFacetConfiguration(grammar));
ctx.writeFile(outlet_src_gen, this._ideaPluginClassNames.toJavaPath(this._ideaPluginClassNames.baseColorSettingsPage(grammar)), this.compileBaseColorSettingsPage(grammar));
ctx.writeFile(outlet_src, this._ideaPluginClassNames.toXtendPath(this._ideaPluginClassNames.colorSettingsPage(grammar)), this.compileColorSettingsPage(grammar));
OutputImpl output = new OutputImpl();
this.addOutlet(output, IdeaPluginGenerator.PLUGIN, false, this.ideaProjectPath);
this.addOutlet(output, IdeaPluginGenerator.META_INF_PLUGIN, false, (this.ideaProjectPath + "/META-INF"));
this.addOutlet(output, IdeaPluginGenerator.META_INF_PLUGIN_GEN, true, (this.ideaProjectPath + "/META-INF"));
if (this.deployable) {
this.writeFile(output, IdeaPluginGenerator.META_INF_PLUGIN, "plugin.xml", this.compilePluginXml(grammar));
this.writeFile(output, IdeaPluginGenerator.META_INF_PLUGIN_GEN, "plugin_gen.xml", this.compilePluginGenXml(grammar));
}
}
Aggregations