public final class DocumentUtil
extends java.lang.Object
Document
processing.Modifier and Type | Method and Description |
---|---|
static int |
alignToCodePointBoundary(Document document,
int offset) |
static void |
executeInBulk(Document document,
boolean executeInBulk,
java.lang.Runnable task)
Ensures that given task is executed when given document is at the given 'in bulk' mode.
|
static int |
getFirstNonSpaceCharOffset(Document document,
int line) |
static int |
getFirstNonSpaceCharOffset(Document document,
int startOffset,
int endOffset) |
static java.lang.CharSequence |
getIndent(Document document,
int offset)
Calculates indent of the line containing
offset |
static int |
getLineEndOffset(int offset,
Document document) |
static int |
getLineStartOffset(int offset,
Document document) |
static TextRange |
getLineTextRange(Document document,
int line) |
static int |
getNextCodePointOffset(Document document,
int offset) |
static int |
getPreviousCodePointOffset(Document document,
int offset) |
static boolean |
isAtLineEnd(int offset,
Document document) |
static boolean |
isAtLineStart(int offset,
Document document) |
static boolean |
isInsideCharacterPair(Document document,
int offset)
Tells whether given offset lies between surrogate pair characters or between characters of Windows-style line break (\r\n).
|
static boolean |
isInsideSurrogatePair(Document document,
int offset) |
static boolean |
isLineEmpty(Document document,
int line) |
static boolean |
isSurrogatePair(Document document,
int offset) |
static boolean |
isValidOffset(int offset,
Document document) |
static void |
writeInRunUndoTransparentAction(java.lang.Runnable runnable) |
public static void executeInBulk(Document document, boolean executeInBulk, java.lang.Runnable task)
document
- target documentexecuteInBulk
- true
to force given document to be in bulk mode when given task is executed;
false
to force given document to be not in bulk mode when given task is executedtask
- task to executeDocument.setInBulkUpdate(boolean)
public static void writeInRunUndoTransparentAction(java.lang.Runnable runnable)
public static int getFirstNonSpaceCharOffset(Document document, int line)
public static int getFirstNonSpaceCharOffset(Document document, int startOffset, int endOffset)
public static boolean isValidOffset(int offset, Document document)
public static int getLineStartOffset(int offset, Document document)
public static int getLineEndOffset(int offset, Document document)
public static boolean isAtLineStart(int offset, Document document)
public static boolean isAtLineEnd(int offset, Document document)
public static int alignToCodePointBoundary(Document document, int offset)
public static boolean isSurrogatePair(Document document, int offset)
public static boolean isInsideSurrogatePair(Document document, int offset)
public static int getPreviousCodePointOffset(Document document, int offset)
public static int getNextCodePointOffset(Document document, int offset)
public static boolean isInsideCharacterPair(Document document, int offset)
public static boolean isLineEmpty(Document document, int line)
public static java.lang.CharSequence getIndent(Document document, int offset)
offset