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

项目:xtext-core    文件:HiddenRegionReplacer.java   
@Override
public ITextReplacerContext createReplacements(ITextReplacerContext context) {
    AbstractFormatter2 formatter = context.getFormatter();
    List<IHiddenRegionPart> hiddens = region.getParts();
    if (hiddens.isEmpty()) {
        return formatter.createWhitespaceReplacer(region, formatting).createReplacements(context);
    } else if ((hiddens.size() == 1 && hiddens.get(0) instanceof IWhitespace)) {
        return formatter.createWhitespaceReplacer(hiddens.get(0), formatting).createReplacements(context);
    } else {
        List<ITextReplacer> replacers = createReplacers(formatter);
        applyHiddenRegionFormatting(replacers);
        ITextReplacerContext current = context;
        current.setNextReplacerIsChild();
        for (ITextReplacer replacer : replacers)
            current = replacer.createReplacements(current.withReplacer(replacer));
        return current;
    }
}
项目:xtext-extras    文件:FormatterStubGenerator.java   
public String getStubSuperClassName() {
  final Grammar superGrammar = IInheriting.Util.getNonTerminalsSuperGrammar(this.grammar);
  if ((superGrammar != null)) {
    return this.service.createGenerator(superGrammar).getStubQualifiedName();
  } else {
    return AbstractFormatter2.class.getName();
  }
}
项目:xtext-core    文件:FormattableDocument.java   
@Override
public Pair<IHiddenRegion, IHiddenRegion> set(IHiddenRegion first, IHiddenRegion second,
        Procedure1<? super IHiddenRegionFormatter> init) {
    if (first != null && second != null) {
        AbstractFormatter2 formatter = getFormatter();
        IHiddenRegionFormatting f1 = formatter.createHiddenRegionFormatting();
        IHiddenRegionFormatting f2 = formatter.createHiddenRegionFormatting();
        init.apply(formatter.createHiddenRegionFormatter(f1, f2));
        ITextReplacer replacer1 = formatter.createHiddenRegionReplacer(first, f1);
        ITextReplacer replacer2 = formatter.createHiddenRegionReplacer(second, f2);
        addReplacer(replacer1);
        addReplacer(replacer2);
    }
    return Pair.of(first, second);
}
项目:xtext-core    文件:FormattableDocument.java   
@Override
public IHiddenRegion set(IHiddenRegion hiddenRegion, Procedure1<? super IHiddenRegionFormatter> init) {
    if (hiddenRegion != null) {
        AbstractFormatter2 formatter = getFormatter();
        IHiddenRegionFormatting formatting = formatter.createHiddenRegionFormatting();
        init.apply(formatter.createHiddenRegionFormatter(formatting));
        ITextReplacer replacer = formatter.createHiddenRegionReplacer(hiddenRegion, formatting);
        addReplacer(replacer);
    }
    return hiddenRegion;
}
项目:xtext-core    文件:Formatter2Fragment2.java   
protected TypeReference getStubSuperClass() {
  final Grammar superGrammar = GrammarUtil2.getNonTerminalsSuperGrammar(this.getLanguage().getGrammar());
  if ((superGrammar != null)) {
    return this.getFormatter2Stub(superGrammar);
  } else {
    return TypeReference.typeRef(AbstractFormatter2.class);
  }
}
项目:xtext-core    文件:HiddenRegionFormattingMerger.java   
public HiddenRegionFormattingMerger(AbstractFormatter2 formatter) {
    super();
    this.formatter = formatter;
}
项目:xtext-core    文件:TextReplacerMerger.java   
public TextReplacerMerger(AbstractFormatter2 formatter) {
    super();
    this.formatter = formatter;
    this.merger = formatter.createHiddenRegionFormattingMerger();
}
项目:xtext-core    文件:SubDocument.java   
@Override
public AbstractFormatter2 getFormatter() {
    return parent.getFormatter();
}
项目:xtext-core    文件:HiddenRegionFormatting.java   
public HiddenRegionFormatting(AbstractFormatter2 formatter) {
    super();
    this.formatter = formatter;
}
项目:xtext-core    文件:HiddenRegionFormatting.java   
public AbstractFormatter2 getFormatter() {
    return formatter;
}
项目:xtext-core    文件:RootDocument.java   
public RootDocument(AbstractFormatter2 formatter) {
    super();
    this.formatter = formatter;
}
项目:xtext-core    文件:RootDocument.java   
@Override
public AbstractFormatter2 getFormatter() {
    return formatter;
}
项目:xtext-core    文件:TextReplacerContext.java   
@Override
public AbstractFormatter2 getFormatter() {
    return document.getFormatter();
}
项目:xtext-core    文件:TextReplacerContext.java   
@Override
public String getIndentationString(int indentationLevel) {
    AbstractFormatter2 formatter = document.getFormatter();
    return Strings.repeat(formatter.getPreference(FormatterPreferenceKeys.indentation), indentationLevel);
}