本文整理汇总了Java中com.intellij.formatting.Indent.getLabelIndent方法的典型用法代码示例。如果您正苦于以下问题:Java Indent.getLabelIndent方法的具体用法?Java Indent.getLabelIndent怎么用?Java Indent.getLabelIndent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.formatting.Indent
的用法示例。
在下文中一共展示了Indent.getLabelIndent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitLabeledStatement
import com.intellij.formatting.Indent; //导入方法依赖的package包/类
@Override
public void visitLabeledStatement(GrLabeledStatement labeledStatement) {
if (myChildType == GroovyTokenTypes.mIDENT) {
CommonCodeStyleSettings.IndentOptions indentOptions = myBlock.getContext().getSettings().getIndentOptions();
if (indentOptions != null && indentOptions.LABEL_INDENT_ABSOLUTE) {
myResult = Indent.getAbsoluteLabelIndent();
}
else if (!myBlock.getContext().getGroovySettings().INDENT_LABEL_BLOCKS) {
myResult = Indent.getLabelIndent();
}
}
else {
if (myBlock.getContext().getGroovySettings().INDENT_LABEL_BLOCKS) {
myResult = Indent.getLabelIndent();
}
}
}
示例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();
}