本文整理汇总了Java中com.intellij.formatting.Indent.Type方法的典型用法代码示例。如果您正苦于以下问题:Java Indent.Type方法的具体用法?Java Indent.Type怎么用?Java Indent.Type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.formatting.Indent
的用法示例。
在下文中一共展示了Indent.Type方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasNormalIndent
import com.intellij.formatting.Indent; //导入方法依赖的package包/类
private static boolean hasNormalIndent(Block block) {
final TextRange range = block.getTextRange();
final int startOffset = range.getStartOffset();
List<Indent.Type> allIndents = getIndentOnStartOffset(block, range, startOffset);
if (hasOnlyNormalOrNoneIndents(allIndents)) {
int normalIndents = ContainerUtil.filter(allIndents, new Condition<Indent.Type>() {
@Override
public boolean value(Indent.Type type) {
return type == Indent.Type.NORMAL;
}
}).size();
return normalIndents < 2;
}
return false;
}
示例2: hasOnlyNormalOrNoneIndents
import com.intellij.formatting.Indent; //导入方法依赖的package包/类
private static boolean hasOnlyNormalOrNoneIndents(List<Indent.Type> indents) {
Indent.Type outerMostIndent = indents.get(0);
if (outerMostIndent != Indent.Type.NONE && outerMostIndent != Indent.Type.NORMAL) {
return false;
}
List<Indent.Type> innerIndents = indents.subList(1, indents.size());
for (Indent.Type indent : innerIndents) {
if (indent != Indent.Type.NONE && indent != Indent.Type.NORMAL
&& indent != Indent.Type.CONTINUATION_WITHOUT_FIRST) {
//continuation without first here because it is CONTINUATION only if it's owner is not the first child
return false;
}
}
return true;
}
示例3: getIndentOnStartOffset
import com.intellij.formatting.Indent; //导入方法依赖的package包/类
private static List<Indent.Type> getIndentOnStartOffset(Block block, TextRange range, int startOffset) {
List<Indent.Type> indentsOnStartOffset = new ArrayList<Indent.Type>();
while (block != null && range.getStartOffset() == startOffset) {
Indent.Type type = block.getIndent() != null ? block.getIndent().getType() : Indent.Type.CONTINUATION_WITHOUT_FIRST;
indentsOnStartOffset.add(type);
if (block instanceof AbstractBlock) {
((AbstractBlock)block).setBuildIndentsOnly(true);
}
List<Block> subBlocks = block.getSubBlocks();
block = subBlocks.isEmpty() ? null : subBlocks.get(0);
}
return indentsOnStartOffset;
}