public class EditorActionUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.Object |
DELETE_COMMAND_GROUP |
protected static java.lang.Object |
EDIT_COMMAND_GROUP |
Modifier and Type | Method and Description |
---|---|
static EditorPopupHandler |
createEditorPopupHandler(ActionGroup group)
Deprecated.
Use
EditorEx.setContextMenuGroupId(String) or
EditorEx.installPopupHandler(com.intellij.openapi.editor.ex.EditorPopupHandler) instead. To be removed in version 2020.2. |
static EditorPopupHandler |
createEditorPopupHandler(java.lang.String groupId)
Deprecated.
Use
EditorEx.setContextMenuGroupId(String) or
EditorEx.installPopupHandler(com.intellij.openapi.editor.ex.EditorPopupHandler) instead. To be removed in version 2020.2. |
static int |
findFirstNonSpaceColumnOnTheLine(Editor editor,
int visualLineNumber)
Tries to find visual column that points to the first non-white space symbol at the visual line at the given editor.
|
static int |
findFirstNonSpaceOffsetInRange(java.lang.CharSequence text,
int start,
int end)
Tries to find non white space symbol at the given range at the given document.
|
static int |
findFirstNonSpaceOffsetOnTheLine(Document document,
int lineNumber) |
static int |
getNextCaretStopOffset(Editor editor,
CaretStopPolicy caretStopPolicy,
boolean isCamel) |
static int |
getNextCaretStopOffset(Editor editor,
CaretStopPolicy caretStopPolicy,
boolean isCamel,
boolean handleQuoted) |
static int |
getNextLineStopOffset(Editor editor,
CaretStop lineStop) |
static int |
getPreviousCaretStopOffset(Editor editor,
CaretStopPolicy caretStopPolicy,
boolean isCamel) |
static int |
getPreviousCaretStopOffset(Editor editor,
CaretStopPolicy caretStopPolicy,
boolean isCamel,
boolean handleQuoted) |
static int |
getPreviousLineStopOffset(Editor editor,
CaretStop lineStop) |
static TextRange |
getRangeToWordEnd(Editor editor,
boolean isCamel,
boolean handleQuoted) |
static TextRange |
getRangeToWordStart(Editor editor,
boolean isCamel,
boolean handleQuoted) |
static void |
indentLine(Project project,
Editor editor,
int lineNumber,
int indent) |
static int |
indentLine(Project project,
Editor editor,
int lineNumber,
int indent,
int caretOffset) |
static boolean |
isHumpBound(java.lang.CharSequence text,
int offset,
boolean isStart) |
static boolean |
isLexemeBoundary(Editor editor,
int offset)
Finds out whether there's a boundary between two lexemes of different type at given offset.
|
static boolean |
isWordBoundary(java.lang.CharSequence text,
int offset,
boolean isCamel,
boolean isStart) |
static boolean |
isWordEnd(java.lang.CharSequence text,
int offset,
boolean isCamel) |
static boolean |
isWordOrLexemeEnd(Editor editor,
int offset,
boolean isCamel) |
static boolean |
isWordOrLexemeStart(Editor editor,
int offset,
boolean isCamel) |
static boolean |
isWordStart(java.lang.CharSequence text,
int offset,
boolean isCamel) |
static void |
makePositionVisible(Editor editor,
int offset)
This method will make required expansions of collapsed region to make given offset 'visible'.
|
static void |
moveCaret(Caret caret,
int offset,
boolean withSelection) |
static void |
moveCaretPageBottom(Editor editor,
boolean isWithSelection) |
static void |
moveCaretPageDown(Editor editor,
boolean isWithSelection) |
static void |
moveCaretPageTop(Editor editor,
boolean isWithSelection) |
static void |
moveCaretPageUp(Editor editor,
boolean isWithSelection) |
static void |
moveCaretRelativelyAndScroll(Editor editor,
int columnShift,
int lineShift,
boolean withSelection) |
static void |
moveCaretToLineEnd(Editor editor,
boolean isWithSelection) |
static void |
moveCaretToLineEnd(Editor editor,
boolean isWithSelection,
boolean ignoreTrailingWhitespace)
Moves caret to visual line end.
|
static void |
moveCaretToLineStart(Editor editor,
boolean isWithSelection)
Depending on the current caret position and 'smart Home' editor settings, moves caret to the start of current visual line
or to the first non-whitespace character on it.
|
static void |
moveCaretToLineStartIgnoringSoftWraps(Editor editor)
This method moves caret to the nearest preceding visual line start, which is not a soft line wrap
|
static void |
moveCaretToNextWord(Editor editor,
boolean isWithSelection,
boolean camel) |
static void |
moveCaretToPreviousWord(Editor editor,
boolean isWithSelection,
boolean camel) |
static void |
moveToNextCaretStop(Editor editor,
CaretStopPolicy caretStopPolicy,
boolean isWithSelection,
boolean isCamel) |
static void |
moveToPreviousCaretStop(Editor editor,
CaretStopPolicy caretStopPolicy,
boolean isWithSelection,
boolean isCamel) |
static void |
scrollRelatively(Editor editor,
int lineShift,
int columnShift,
boolean moveCaret)
Tries to change given editor's viewport position in vertical dimension by the given number of visual lines.
|
static void |
selectNonexpandableFold(Editor editor) |
static boolean |
shouldUseSmartTabs(Project project,
Editor editor) |
protected static final java.lang.Object EDIT_COMMAND_GROUP
public static final java.lang.Object DELETE_COMMAND_GROUP
public static void scrollRelatively(Editor editor, int lineShift, int columnShift, boolean moveCaret)
editor
- target editor which viewport position should be changedlineShift
- defines viewport position's vertical change lengthcolumnShift
- defines viewport position's horizontal change lengthmoveCaret
- flag that identifies whether caret should be moved if its current position becomes off-screenpublic static void moveCaretRelativelyAndScroll(Editor editor, int columnShift, int lineShift, boolean withSelection)
public static void indentLine(Project project, Editor editor, int lineNumber, int indent)
public static int indentLine(Project project, Editor editor, int lineNumber, int indent, int caretOffset)
public static TextRange getRangeToWordEnd(Editor editor, boolean isCamel, boolean handleQuoted)
public static TextRange getRangeToWordStart(Editor editor, boolean isCamel, boolean handleQuoted)
public static int getNextCaretStopOffset(Editor editor, CaretStopPolicy caretStopPolicy, boolean isCamel)
public static int getPreviousCaretStopOffset(Editor editor, CaretStopPolicy caretStopPolicy, boolean isCamel)
public static int getNextCaretStopOffset(Editor editor, CaretStopPolicy caretStopPolicy, boolean isCamel, boolean handleQuoted)
public static int getPreviousCaretStopOffset(Editor editor, CaretStopPolicy caretStopPolicy, boolean isCamel, boolean handleQuoted)
public static int getNextLineStopOffset(Editor editor, CaretStop lineStop)
public static int getPreviousLineStopOffset(Editor editor, CaretStop lineStop)
public static boolean isWordOrLexemeStart(Editor editor, int offset, boolean isCamel)
public static boolean isWordOrLexemeEnd(Editor editor, int offset, boolean isCamel)
public static boolean isLexemeBoundary(Editor editor, int offset)
public static void moveCaretToLineStart(Editor editor, boolean isWithSelection)
isWithSelection
- if true - sets selection from old caret position to the new one, if false - clears selectionmoveCaretToLineStartIgnoringSoftWraps(Editor)
public static int findFirstNonSpaceColumnOnTheLine(Editor editor, int visualLineNumber)
editor
- target editorvisualLineNumber
- target visual line'-1'
otherwisepublic static int findFirstNonSpaceOffsetOnTheLine(Document document, int lineNumber)
public static int findFirstNonSpaceOffsetInRange(java.lang.CharSequence text, int start, int end)
text
- text to be inspectedstart
- target start offset (inclusive)end
- target end offset (exclusive)'-1'
otherwisepublic static void moveCaretToLineEnd(Editor editor, boolean isWithSelection)
public static void moveCaretToLineEnd(Editor editor, boolean isWithSelection, boolean ignoreTrailingWhitespace)
editor
- target editorisWithSelection
- whether selection should be set from original caret position to its target positionignoreTrailingWhitespace
- if true
, line end will be determined while ignoring trailing whitespace, unless caret is
already at so-determined target position, in which case trailing whitespace will be taken into accountpublic static void moveCaretToNextWord(Editor editor, boolean isWithSelection, boolean camel)
public static void moveToNextCaretStop(Editor editor, CaretStopPolicy caretStopPolicy, boolean isWithSelection, boolean isCamel)
public static void selectNonexpandableFold(Editor editor)
public static void moveCaretToPreviousWord(Editor editor, boolean isWithSelection, boolean camel)
public static void moveToPreviousCaretStop(Editor editor, CaretStopPolicy caretStopPolicy, boolean isWithSelection, boolean isCamel)
public static void moveCaretPageUp(Editor editor, boolean isWithSelection)
public static void moveCaretPageDown(Editor editor, boolean isWithSelection)
public static void moveCaretPageTop(Editor editor, boolean isWithSelection)
public static void moveCaretPageBottom(Editor editor, boolean isWithSelection)
@Deprecated public static EditorPopupHandler createEditorPopupHandler(java.lang.String groupId)
EditorEx.setContextMenuGroupId(String)
or
EditorEx.installPopupHandler(com.intellij.openapi.editor.ex.EditorPopupHandler)
instead. To be removed in version 2020.2.@Deprecated public static EditorPopupHandler createEditorPopupHandler(ActionGroup group)
EditorEx.setContextMenuGroupId(String)
or
EditorEx.installPopupHandler(com.intellij.openapi.editor.ex.EditorPopupHandler)
instead. To be removed in version 2020.2.public static boolean isWordStart(java.lang.CharSequence text, int offset, boolean isCamel)
public static boolean isWordEnd(java.lang.CharSequence text, int offset, boolean isCamel)
public static boolean isWordBoundary(java.lang.CharSequence text, int offset, boolean isCamel, boolean isStart)
public static boolean isHumpBound(java.lang.CharSequence text, int offset, boolean isStart)
public static void moveCaretToLineStartIgnoringSoftWraps(Editor editor)
public static void makePositionVisible(Editor editor, int offset)
public static void moveCaret(Caret caret, int offset, boolean withSelection)