本文整理汇总了Java中com.intellij.formatting.Indent.getAbsoluteNoneIndent方法的典型用法代码示例。如果您正苦于以下问题:Java Indent.getAbsoluteNoneIndent方法的具体用法?Java Indent.getAbsoluteNoneIndent怎么用?Java Indent.getAbsoluteNoneIndent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.formatting.Indent
的用法示例。
在下文中一共展示了Indent.getAbsoluteNoneIndent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIndent
import com.intellij.formatting.Indent; //导入方法依赖的package包/类
/**
* @param node An ASTNode
* @return The calculated indent for the given node
*/
public static Indent getIndent(ASTNode node) {
IElementType type = node.getElementType();
Indent indent = Indent.getNoneIndent();
ASTNode parent = node.getTreeParent();
if (parent == null) {
return indent;
}
if (TYPES_WHICH_PROVOKE_AN_INDENT.contains(parent.getElementType())) {
indent = Indent.getIndent(Indent.Type.NORMAL, false, true);
}
if (TYPES_WHICH_DO_NOT_NEED_AN_BEGINNING_INDENT.contains(type)) {
indent = Indent.getNoneIndent();
}
if (TYPES_WHICH_CANNOT_GET_AN_INDENT.contains(type)) {
indent = Indent.getAbsoluteNoneIndent();
}
return indent;
}
示例2: getChildIndent
import com.intellij.formatting.Indent; //导入方法依赖的package包/类
/**
* Calculates indent, based on code style, between parent block and child node
*
* @param parentBlock parent block
* @param child child node
* @return indent
*/
@NotNull
public Indent getChildIndent(@NotNull final GroovyBlock parentBlock, @NotNull final ASTNode child) {
myChildType = child.getElementType();
if (parentBlock instanceof ClosureBodyBlock) {
if (myChildType == GroovyElementTypes.PARAMETERS_LIST) {
return Indent.getNoneIndent();
}
else if (myChildType != GroovyTokenTypes.mLCURLY && myChildType != GroovyTokenTypes.mRCURLY) {
return Indent.getNormalIndent();
}
}
if (parentBlock instanceof GrLabelBlock) {
ASTNode first = parentBlock.getNode().getFirstChildNode();
return child == first
? Indent.getNoneIndent()
: Indent.getLabelIndent();
}
if (GSTRING_TOKENS_INNER.contains(myChildType)) {
return Indent.getAbsoluteNoneIndent();
}
final PsiElement parent = parentBlock.getNode().getPsi();
if (parent instanceof GroovyPsiElement) {
myBlock = parentBlock;
myChild = child.getPsi();
((GroovyPsiElement)parent).accept(this);
if (myResult != null) return myResult;
}
return Indent.getNoneIndent();
}
示例3: getIndent
import com.intellij.formatting.Indent; //导入方法依赖的package包/类
@Override
public Indent getIndent() {
return Indent.getAbsoluteNoneIndent();
}