Java 类org.eclipse.xtext.formatting2.internal.WhitespaceReplacer 实例源码

项目:n4js    文件:OffMultilineCommentReplacer.java   
@Override
public void configureWhitespace(WhitespaceReplacer leading, WhitespaceReplacer trailing) {
    if (noIndent) {
        leading.getFormatting().setNoIndentation(true);
        trailing.getFormatting().setNoIndentation(true);
    }
}
项目:n4js    文件:FixedMultilineCommentReplacer.java   
@Override
public void configureWhitespace(WhitespaceReplacer leading, WhitespaceReplacer trailing) {
    if (multiline) {
        enforceNewLine(leading);
        enforceNewLine(trailing);
    } else {
        enforceSingleSpace(leading);
        enforceSingleSpace(trailing);
    }
}
项目:n4js    文件:FixedMultilineCommentReplacer.java   
/** */
protected void enforceNewLine(WhitespaceReplacer replacer) {
    if (replacer.getRegion().getOffset() <= 0)
        return;
    Integer min = replacer.getFormatting().getNewLineMin();
    if (min == null || min < 1)
        replacer.getFormatting().setNewLinesMin(1);
}
项目:n4js    文件:FixedMultilineCommentReplacer.java   
/** */
protected void enforceSingleSpace(WhitespaceReplacer replacer) {
    if (replacer.getRegion().getOffset() <= 0)
        return;
    String space = replacer.getFormatting().getSpace();
    if (space == null || space.length() < 1)
        replacer.getFormatting().setSpace(" ");
}
项目:xtext-core    文件:AbstractFormatter2.java   
public ITextReplacer createWhitespaceReplacer(ITextSegment hiddens, IHiddenRegionFormatting formatting) {
    return new WhitespaceReplacer(hiddens, formatting);
}