use of org.eclipse.xtext.generator.BindFactory in project dsl-devkit by dsldevkit.
the class FormatterFragment method getGuiceBindingsRt.
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
final Set<Binding> bindings = super.getGuiceBindingsRt(grammar);
BindFactory bindFactory = new BindFactory();
bindings.addAll(bindFactory.addTypeToType(INodeModelFormatter.class.getName(), RegionNodeModelFormatter.class.getName()).getBindings());
bindings.addAll(bindFactory.addTypeToType(INodeModelStreamer.class.getName(), DirectNodeModelStreamer.class.getName()).getBindings());
return bindings;
}
use of org.eclipse.xtext.generator.BindFactory in project dsl-devkit by dsldevkit.
the class ExportFragment method getGuiceBindingsRt.
/**
* {@inheritDoc}
*/
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
final BindFactory bindFactory = new BindFactory();
// $NON-NLS-1$
final String namingPrefix = GrammarUtil.getNamespace(grammar) + ".naming." + GrammarUtil.getName(grammar);
// $NON-NLS-1$
final String resourcePrefix = GrammarUtil.getNamespace(grammar) + ".resource." + GrammarUtil.getName(grammar);
ExportModel m = getModel(grammar);
if (m != null) {
// $NON-NLS-1$
bindFactory.addTypeToType(IQualifiedNameProvider.class.getName(), namingPrefix + "ExportedNamesProvider");
if (!m.getInterfaces().isEmpty()) {
// $NON-NLS-1$
bindFactory.addTypeToType(IFingerprintComputer.class.getName(), resourcePrefix + "FingerprintComputer");
}
if (!m.getExports().isEmpty()) {
// $NON-NLS-1$
bindFactory.addTypeToType(IDefaultResourceDescriptionStrategy.class.getName(), resourcePrefix + "ResourceDescriptionStrategy");
}
if (Iterables.any(m.getExports(), new Predicate<Export>() {
@Override
public boolean apply(final Export input) {
return input.isFingerprint() && input.getFragmentAttribute() != null;
}
})) {
// $NON-NLS-1$
bindFactory.addTypeToType(IFragmentProvider.class.getName(), resourcePrefix + "FragmentProvider");
}
}
// $NON-NLS-1$
bindFactory.addTypeToType(IResourceDescription.Manager.class.getName(), resourcePrefix + "ResourceDescriptionManager");
return bindFactory.getBindings();
}
use of org.eclipse.xtext.generator.BindFactory in project dsl-devkit by dsldevkit.
the class CheckValidatorFragment method getGuiceBindingsRt.
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
BindFactory factory = new BindFactory();
factory.addTypeToTypeEagerSingleton(AbstractCheckValidator.class.getName(), DefaultCheckValidator.class.getName());
return factory.getBindings();
}
use of org.eclipse.xtext.generator.BindFactory in project dsl-devkit by dsldevkit.
the class FormatFragment method getGuiceBindingsRt.
/**
* {@inheritDoc}
*/
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
final BindFactory bindFactory = new BindFactory();
bindFactory.addTypeToType(IFormatter.class.getName(), FormatGeneratorUtil.getFormatterName(grammar, ""));
bindFactory.addTypeToType(INodeModelFormatter.class.getName(), RegionNodeModelFormatter.class.getName());
bindFactory.addTypeToType(INodeModelStreamer.class.getName(), DirectNodeModelStreamer.class.getName());
return bindFactory.getBindings();
}
Aggregations