public class EditorModificationUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static Key<java.lang.String> |
READ_ONLY_VIEW_MESSAGE_KEY
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static int |
calcAfterLineEnd(Editor editor)
Calculates difference in columns between current editor caret position and end of the logical line fragment displayed
on a current visual line.
|
static java.util.List<CaretState> |
calcBlockSelectionState(Editor editor,
LogicalPosition blockStart,
LogicalPosition blockEnd) |
static java.lang.String |
calcStringToFillVirtualSpace(Editor editor) |
static java.lang.String |
calcStringToFillVirtualSpace(Editor editor,
int afterLineEnd) |
static boolean |
checkModificationAllowed(Editor editor) |
static void |
deleteSelectedText(Editor editor) |
static void |
deleteSelectedTextForAllCarets(Editor editor) |
static java.awt.datatransfer.Transferable |
getContentsToPasteToEditor(Producer<? extends java.awt.datatransfer.Transferable> producer) |
static java.lang.String |
getStringContent(java.awt.datatransfer.Transferable content) |
static void |
insertStringAtCaret(Editor editor,
java.lang.String s) |
static int |
insertStringAtCaret(Editor editor,
java.lang.String s,
boolean toProcessOverwriteMode) |
static int |
insertStringAtCaret(Editor editor,
java.lang.String s,
boolean toProcessOverwriteMode,
boolean toMoveCaret) |
static int |
insertStringAtCaret(Editor editor,
java.lang.String s,
boolean toProcessOverwriteMode,
boolean toMoveCaret,
int caretShift) |
static int |
insertStringAtCaret(Editor editor,
java.lang.String s,
boolean toProcessOverwriteMode,
int caretShift) |
static void |
moveAllCaretsRelatively(Editor editor,
int caretShift) |
static void |
moveCaretRelatively(Editor editor,
int caretShift) |
static void |
pasteTransferableAsBlock(Editor editor,
java.util.function.Supplier<? extends java.awt.datatransfer.Transferable> producer) |
static boolean |
requestWriting(Editor editor) |
static void |
scrollToCaret(Editor editor)
This method is safe to run both in and out of
CaretModel.runForEachCaret(CaretAction) context. |
static void |
setReadOnlyHint(Editor editor,
java.lang.String message) |
static void |
setReadOnlyHint(Editor editor,
java.lang.String message,
javax.swing.event.HyperlinkListener linkListener)
Change hint that is displayed on attempt to modify text when editor is in view mode.
|
static void |
typeInStringAtCaretHonorMultipleCarets(Editor editor,
java.lang.String str) |
static void |
typeInStringAtCaretHonorMultipleCarets(Editor editor,
java.lang.String str,
boolean toProcessOverwriteMode) |
static void |
typeInStringAtCaretHonorMultipleCarets(Editor editor,
java.lang.String str,
boolean toProcessOverwriteMode,
int caretShift)
Inserts given string at each caret's position.
|
static void |
typeInStringAtCaretHonorMultipleCarets(Editor editor,
java.lang.String str,
int caretShift) |
static void |
zeroWidthBlockSelectionAtCaretColumn(Editor editor,
int startLine,
int endLine) |
@Deprecated public static final Key<java.lang.String> READ_ONLY_VIEW_MESSAGE_KEY
setReadOnlyHint(Editor, String)
public static void deleteSelectedText(Editor editor)
public static void deleteSelectedTextForAllCarets(Editor editor)
public static void zeroWidthBlockSelectionAtCaretColumn(Editor editor, int startLine, int endLine)
public static void insertStringAtCaret(Editor editor, java.lang.String s)
public static int insertStringAtCaret(Editor editor, java.lang.String s, boolean toProcessOverwriteMode)
public static int insertStringAtCaret(Editor editor, java.lang.String s, boolean toProcessOverwriteMode, boolean toMoveCaret)
public static int insertStringAtCaret(Editor editor, java.lang.String s, boolean toProcessOverwriteMode, int caretShift)
public static int insertStringAtCaret(Editor editor, java.lang.String s, boolean toProcessOverwriteMode, boolean toMoveCaret, int caretShift)
public static void pasteTransferableAsBlock(Editor editor, java.util.function.Supplier<? extends java.awt.datatransfer.Transferable> producer)
public static java.awt.datatransfer.Transferable getContentsToPasteToEditor(Producer<? extends java.awt.datatransfer.Transferable> producer)
public static java.lang.String getStringContent(java.awt.datatransfer.Transferable content)
public static int calcAfterLineEnd(Editor editor)
editor
- target editorpublic static java.lang.String calcStringToFillVirtualSpace(Editor editor)
public static java.lang.String calcStringToFillVirtualSpace(Editor editor, int afterLineEnd)
public static void typeInStringAtCaretHonorMultipleCarets(Editor editor, java.lang.String str)
public static void typeInStringAtCaretHonorMultipleCarets(Editor editor, java.lang.String str, int caretShift)
public static void typeInStringAtCaretHonorMultipleCarets(Editor editor, java.lang.String str, boolean toProcessOverwriteMode)
public static void typeInStringAtCaretHonorMultipleCarets(Editor editor, java.lang.String str, boolean toProcessOverwriteMode, int caretShift) throws ReadOnlyFragmentModificationException
caretShift
for each caret.public static void moveAllCaretsRelatively(Editor editor, int caretShift)
public static void moveCaretRelatively(Editor editor, int caretShift)
public static void scrollToCaret(Editor editor)
CaretModel.runForEachCaret(CaretAction)
context.
It scrolls to primary caret in both cases, and, in the former case, avoids performing excessive scrolling in case of large number
of carets.public static java.util.List<CaretState> calcBlockSelectionState(Editor editor, LogicalPosition blockStart, LogicalPosition blockEnd)
public static boolean requestWriting(Editor editor)
public static boolean checkModificationAllowed(Editor editor)
public static void setReadOnlyHint(Editor editor, java.lang.String message)
public static void setReadOnlyHint(Editor editor, java.lang.String message, javax.swing.event.HyperlinkListener linkListener)
message
- New hint message or null
if default message should be used instead.linkListener
- Callback for html hyperlinks that can be used in hint message.