Java 类org.eclipse.xtext.formatting2.IFormatter2 实例源码

项目:xtext-extras    文件:Formatter2Fragment.java   
@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();
}
项目:xtext-core    文件:FormattingService.java   
protected List<ITextReplacement> format2(final XtextResource resource, final ITextRegion selection, final ITypedPreferenceValues preferences) {
  final FormatterRequest request = this.formatterRequestProvider.get();
  request.setAllowIdentityEdits(false);
  request.setFormatUndefinedHiddenRegionsOnly(false);
  if ((selection != null)) {
    request.setRegions(Collections.<ITextRegion>unmodifiableList(CollectionLiterals.<ITextRegion>newArrayList(selection)));
  }
  if ((preferences != null)) {
    request.setPreferences(preferences);
  }
  final ITextRegionAccess regionAccess = this.regionBuilder.forNodeModel(resource).create();
  request.setTextRegionAccess(regionAccess);
  final IFormatter2 formatter2 = this.formatter2Provider.get();
  final List<ITextReplacement> replacements = formatter2.format(request);
  return replacements;
}
项目:xtext-extras    文件:XbaseFormatterTestInjectorProvider.java   
@Override
public Injector createInjector() {
    return Guice.createInjector(new XbaseTestRuntimeModule() {
        @Override
        public void configure(com.google.inject.Binder binder) {
            super.configure(binder);
            binder.bind(IFormatter2.class).to(XbaseFormatter.class);
        }
    });
}
项目:xtext-core    文件:Serializer.java   
protected void serialize(EObject obj, Appendable appendable, SaveOptions options) throws IOException {
    ITextRegionAccess regionAccess = serializeToRegions(obj);
    FormatterRequest request = formatterRequestProvider.get();
    request.setFormatUndefinedHiddenRegionsOnly(!options.isFormatting());
    request.setTextRegionAccess(regionAccess);
    IFormatter2 formatter2 = formatter2Provider.get();
    List<ITextReplacement> replacements = formatter2.format(request);
    regionAccess.getRewriter().renderToAppendable(replacements, appendable);
}
项目:xtext-core    文件:Formatter2Fragment2.java   
@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();
}
项目:n4js    文件:AbstractTypeExpressionsRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return TypeExpressionsFormatter.class;
}
项目:n4js    文件:AbstractN4JSRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return N4JSFormatter.class;
}
项目:n4js    文件:AbstractN4MFRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return N4MFFormatter.class;
}
项目:lcdsl    文件:AbstractLcDslRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return LcDslFormatter.class;
}
项目:gemoc-studio    文件:AbstractDslRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return DslFormatter.class;
}
项目:org.xtext.dsl.restaurante    文件:AbstractRestauranteRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return RestauranteFormatter.class;
}
项目:OCCI-Studio    文件:AbstractOCCIRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return OCCIFormatter.class;
}
项目:xtext-extras    文件:AbstractPureXbaseRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return PureXbaseFormatter.class;
}
项目:xtext-extras    文件:AbstractXbaseRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return XbaseFormatter.class;
}
项目:xtext-extras    文件:AbstractXbaseWithAnnotationsRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return XbaseWithAnnotationsFormatter.class;
}
项目:xtext-extras    文件:AbstractXtypeRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return XtypeFormatter.class;
}
项目:xtext-extras    文件:FormatterTester.java   
protected IFormatter2 createFormatter(FormatterTestRequest request) {
    checkNotNull(formatter, "There is a Guice Binding missing for " + IFormatter2.class.getName());
    return formatter.get();
}
项目:xtext-core    文件:TestLanguageRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
  return TestLanguageFormatter.class;
}
项目:xtext-core    文件:AbstractPartialSerializationTestLanguageRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return PartialSerializationTestLanguageFormatter.class;
}
项目:xtext-core    文件:FormatterTestHelper.java   
protected IFormatter2 createFormatter(FormatterTestRequest request) {
    checkNotNull(formatter, "There is a Guice Binding missing for " + IFormatter2.class.getName());
    return formatter.get();
}
项目:xtext-core    文件:AbstractFileAwareTestLanguageRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return FileAwareTestLanguageFormatter.class;
}
项目:xtext-core    文件:AbstractSimpleBeeLangTestLanguageRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return SimpleBeeLangTestLanguageFormatter.class;
}
项目:xtext-core    文件:AbstractBeeLangTestLanguageRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return BeeLangTestLanguageFormatter.class;
}
项目:xtext-core    文件:AbstractExBeeLangTestLanguageRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return ExBeeLangTestLanguageFormatter.class;
}
项目:xtext-core    文件:AbstractNoJdtTestLanguageRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return NoJdtTestLanguageFormatter.class;
}
项目:xtext-core    文件:FormatterTesterWithImpl.java   
@Override
protected IFormatter2 createFormatter(final FormatterTestRequest req) {
  return ((GenericFormatterTestRequest) req).getFormatter();
}
项目:xtext-core    文件:FormatterSerializerIntegrationTest.java   
public Class<? extends IFormatter2> bindIFormatter2() {
  return FormatterSerializerIntegrationTest.Formatter.class;
}
项目:xtext-core    文件:RegionDiffFormatter.java   
protected IFormatter2 getFormatter() {
    if (formatter != null) {
        return formatter.get();
    }
    return nullFormatter.get();
}
项目:CooperateModelingEnvironment    文件:AbstractComponentRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return ComponentFormatter.class;
}
项目:CooperateModelingEnvironment    文件:AbstractClsRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return ClsFormatter.class;
}
项目:CooperateModelingEnvironment    文件:AbstractUsecaseRuntimeModule.java   
public Class<? extends IFormatter2> bindIFormatter2() {
    return UsecaseFormatter.class;
}