本文整理汇总了Java中com.intellij.util.DocumentUtil.getLineStartOffset方法的典型用法代码示例。如果您正苦于以下问题:Java DocumentUtil.getLineStartOffset方法的具体用法?Java DocumentUtil.getLineStartOffset怎么用?Java DocumentUtil.getLineStartOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.DocumentUtil
的用法示例。
在下文中一共展示了DocumentUtil.getLineStartOffset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleInsert
import com.intellij.util.DocumentUtil; //导入方法依赖的package包/类
@Override
public void handleInsert(InsertionContext context) {
super.handleInsert(context);
Project project = context.getProject();
Document document = context.getDocument();
int lineStartOffset = DocumentUtil.getLineStartOffset(context.getStartOffset(), document);
PsiDocumentManager.getInstance(project).commitDocument(document);
CodeStyleManager.getInstance(project).adjustLineIndent(context.getFile(), lineStartOffset);
}
示例2: getNotFoldedLineStartOffset
import com.intellij.util.DocumentUtil; //导入方法依赖的package包/类
/**
* Finds the start offset of visual line at which given offset is located, not taking soft wraps into account.
*/
public static int getNotFoldedLineStartOffset(@NotNull Editor editor, int offset) {
while(true) {
offset = DocumentUtil.getLineStartOffset(offset, editor.getDocument());
FoldRegion foldRegion = editor.getFoldingModel().getCollapsedRegionAtOffset(offset - 1);
if (foldRegion == null || foldRegion.getStartOffset() >= offset) {
break;
}
offset = foldRegion.getStartOffset();
}
return offset;
}
示例3: getNotFoldedLineStartOffset
import com.intellij.util.DocumentUtil; //导入方法依赖的package包/类
/**
* Finds the start offset of visual line at which given offset is located, not taking soft wraps into account.
*/
public static int getNotFoldedLineStartOffset(@Nonnull Editor editor, int offset) {
while(true) {
offset = DocumentUtil.getLineStartOffset(offset, editor.getDocument());
FoldRegion foldRegion = editor.getFoldingModel().getCollapsedRegionAtOffset(offset - 1);
if (foldRegion == null || foldRegion.getStartOffset() >= offset) {
break;
}
offset = foldRegion.getStartOffset();
}
return offset;
}
示例4: handleInsert
import com.intellij.util.DocumentUtil; //导入方法依赖的package包/类
@Override
public void handleInsert(InsertionContext context)
{
super.handleInsert(context);
Project project = context.getProject();
Document document = context.getDocument();
int lineStartOffset = DocumentUtil.getLineStartOffset(context.getStartOffset(), document);
PsiDocumentManager.getInstance(project).commitDocument(document);
CodeStyleManager.getInstance(project).adjustLineIndent(context.getFile(), lineStartOffset);
}