本文整理汇总了Java中com.intellij.codeInsight.CommentUtil.getMinLineIndent方法的典型用法代码示例。如果您正苦于以下问题:Java CommentUtil.getMinLineIndent方法的具体用法?Java CommentUtil.getMinLineIndent怎么用?Java CommentUtil.getMinLineIndent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInsight.CommentUtil
的用法示例。
在下文中一共展示了CommentUtil.getMinLineIndent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeMinIndent
import com.intellij.codeInsight.CommentUtil; //导入方法依赖的package包/类
private Indent computeMinIndent(Editor editor, PsiFile psiFile, int line1, int line2, FileType fileType) {
Document document = editor.getDocument();
Indent minIndent = CommentUtil.getMinLineIndent(myProject, document, line1, line2, fileType);
if (line1 > 0) {
int commentOffset = getCommentStart(editor, psiFile, line1 - 1);
if (commentOffset >= 0) {
int lineStart = document.getLineStartOffset(line1 - 1);
String space = document.getCharsSequence().subSequence(lineStart, commentOffset).toString();
Indent indent = myCodeStyleManager.getIndent(space, fileType);
minIndent = minIndent != null ? indent.min(minIndent) : indent;
}
}
if (minIndent == null) {
minIndent = myCodeStyleManager.zeroIndent();
}
return minIndent;
}
示例2: computeMinIndent
import com.intellij.codeInsight.CommentUtil; //导入方法依赖的package包/类
private Indent computeMinIndent(int line1, int line2, CharSequence chars, CodeStyleManager codeStyleManager, FileType fileType) {
Indent minIndent = CommentUtil.getMinLineIndent(myProject, myDocument, line1, line2, fileType);
if (line1 > 0) {
int commentOffset = getCommentStart(line1 - 1);
if (commentOffset >= 0) {
int lineStart = myDocument.getLineStartOffset(line1 - 1);
String space = chars.subSequence(lineStart, commentOffset).toString();
Indent indent = codeStyleManager.getIndent(space, fileType);
minIndent = minIndent != null ? indent.min(minIndent) : indent;
}
}
if (minIndent == null) {
minIndent = codeStyleManager.zeroIndent();
}
return minIndent;
}