public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable
Disposable.Parent| Modifier and Type | Method and Description | 
|---|---|
Caret | 
clone(boolean above)
Clones the current caret and positions the new one right above or below the current one. 
 | 
void | 
dispose()
Usually not invoked directly, see class javadoc. 
 | 
java.lang.String | 
dumpState()  | 
CaretModel | 
getCaretModel()
Returns an instance of CaretModel, current caret is associated with. 
 | 
EditorImpl | 
getEditor()
Returns an instance of Editor, current caret belongs to. 
 | 
int | 
getLeadSelectionOffset()
Returns the offset from which the user started to extend the selection (the selection start
 if the selection was extended in forward direction, or the selection end if it was
 extended backward). 
 | 
VisualPosition | 
getLeadSelectionPosition()  | 
LogicalPosition | 
getLogicalPosition()
Returns the logical position of the caret. 
 | 
int | 
getOffset()
Returns the offset of the caret in the document. 
 | 
java.lang.String | 
getSelectedText()
Returns the text selected in the editor. 
 | 
int | 
getSelectionEnd()
Returns the end offset in the document of the selected text range, or the caret
 position if there is currently no selection. 
 | 
VisualPosition | 
getSelectionEndPosition()  | 
int | 
getSelectionStart()
Returns the start offset in the document of the selected text range, or the caret
 position if there is currently no selection. 
 | 
VisualPosition | 
getSelectionStartPosition()  | 
CaretVisualAttributes | 
getVisualAttributes()
Returns visual attributes currently set for the caret. 
 | 
int | 
getVisualLineEnd()  | 
int | 
getVisualLineStart()  | 
VisualPosition | 
getVisualPosition()
Returns the visual position of the caret. 
 | 
boolean | 
hasSelection()
Checks if a range of text is currently selected. 
 | 
boolean | 
isAtBidiRunBoundary()
Returns  
true if caret is located at a boundary between different runs of bidirectional text. | 
boolean | 
isAtRtlLocation()
Returns  
true if caret is located in RTL text fragment. | 
boolean | 
isInVirtualSpace()  | 
boolean | 
isUpToDate()
Caret position may be updated on document change (e.g. 
 | 
boolean | 
isValid()
Tells whether this caret is valid, i.e. 
 | 
void | 
moveCaretRelatively(int _columnShift,
                   int lineShift,
                   boolean withSelection,
                   boolean scrollToCaret)
Moves the caret by the specified number of lines and/or columns. 
 | 
void | 
moveToLogicalPosition(LogicalPosition pos)
Moves the caret to the specified logical position. 
 | 
void | 
moveToOffset(int offset)
Short hand for calling  
Caret.moveToOffset(int, boolean) with 'false' as a second argument. | 
void | 
moveToOffset(int offset,
            boolean locateBeforeSoftWrap)
Moves the caret to the specified offset in the document. 
 | 
void | 
moveToVisualPosition(VisualPosition pos)
Moves the caret to the specified visual position. 
 | 
void | 
removeSelection()
Removes the selection in the editor. 
 | 
void | 
selectLineAtCaret()
Selects the entire line of text at the caret position. 
 | 
void | 
selectWordAtCaret(boolean honorCamelWordsSettings)
Selects the entire word at the caret position, optionally using camel-case rules to
 determine word boundaries. 
 | 
void | 
setSelection(int startOffset,
            int endOffset)
Selects the specified range of text. 
 | 
void | 
setSelection(int startOffset,
            int endOffset,
            boolean updateSystemSelection)
Selects the specified range of text. 
 | 
void | 
setSelection(int startOffset,
            VisualPosition endPosition,
            int endOffset)
Selects target range providing information about visual boundary of selection end. 
 | 
void | 
setSelection(VisualPosition startPosition,
            int startOffset,
            VisualPosition endPosition,
            int endOffset)
Selects target range based on its visual boundaries. 
 | 
void | 
setSelection(VisualPosition startPosition,
            int startOffset,
            VisualPosition endPosition,
            int endOffset,
            boolean updateSystemSelection)
Selects target range based on its visual boundaries. 
 | 
void | 
setVisualAttributes(CaretVisualAttributes attributes)
Sets caret's current visual attributes. 
 | 
java.lang.String | 
toString()  | 
void | 
validateState()  | 
changeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMapequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitputUserDataIfAbsent, replacegetUserData, putUserDatapublic void moveToOffset(int offset)
CaretCaret.moveToOffset(int, boolean) with 'false' as a second argument.moveToOffset in interface Caretoffset - the offset to move topublic void moveToOffset(int offset,
                         boolean locateBeforeSoftWrap)
CaretmoveToOffset in interface Caretoffset - the offset to move to.locateBeforeSoftWrap - there is a possible case that there is a soft wrap at the given offset, hence, the same offset
                                corresponds to two different visual positions - just before soft wrap and just after soft wrap.
                                We may want to clearly indicate where to put the caret then. Given parameter allows to do that.
                                Note: it's ignored if there is no soft wrap at the given offsetpublic CaretModel getCaretModel()
CaretgetCaretModel in interface Caretpublic boolean isValid()
CaretisValid in interface CaretCaretModel.addCaret(VisualPosition), 
CaretModel.removeCaret(Caret)public void moveCaretRelatively(int _columnShift,
                                int lineShift,
                                boolean withSelection,
                                boolean scrollToCaret)
CaretmoveCaretRelatively in interface Caret_columnShift - the number of columns to move the caret by.lineShift - the number of lines to move the caret by.withSelection - if true, the caret move should extend the selection in the document.scrollToCaret - if true, the document should be scrolled so that the caret is visible after the move.public void moveToLogicalPosition(LogicalPosition pos)
CaretmoveToLogicalPosition in interface Caretpos - the position to move to.public void moveToVisualPosition(VisualPosition pos)
CaretmoveToVisualPosition in interface Caretpos - the position to move to.public void dispose()
Disposabledispose in interface Disposablepublic boolean isUpToDate()
CaretisUpToDate in interface Carettrue if caret position is up-to-date for now; false otherwisepublic LogicalPosition getLogicalPosition()
CaretgetLogicalPosition in interface Caretpublic VisualPosition getVisualPosition()
CaretgetVisualPosition in interface Caretpublic int getOffset()
CaretgetOffset in interface CaretCaret.isValid()public int getVisualLineStart()
getVisualLineStart in interface Caretpublic int getVisualLineEnd()
getVisualLineEnd in interface Caretpublic Caret clone(boolean above)
Caretclone in interface Caretabove - if true, new caret will be created at the previous line, if false - on the next linenull if the caret cannot be created because it already exists at the new location
 or caret model doesn't support multiple carets.public int getSelectionStart()
CaretgetSelectionStart in interface Caretpublic VisualPosition getSelectionStartPosition()
getSelectionStartPosition in interface Caretpublic int getSelectionEnd()
CaretgetSelectionEnd in interface Caretpublic VisualPosition getSelectionEndPosition()
getSelectionEndPosition in interface Caretpublic boolean hasSelection()
CarethasSelection in interface Caretpublic void setSelection(int startOffset,
                         int endOffset)
CaretSystem selection will be updated, if such feature is supported by current editor.
setSelection in interface CaretstartOffset - the start offset of the text range to select.endOffset - the end offset of the text range to select.public void setSelection(int startOffset,
                         int endOffset,
                         boolean updateSystemSelection)
CaretsetSelection in interface CaretstartOffset - the start offset of the text range to select.endOffset - the end offset of the text range to select.updateSystemSelection - whether system selection should be updated (might not have any effect if current editor doesn't support such a feature)public void setSelection(int startOffset,
                         VisualPosition endPosition,
                         int endOffset)
CaretSystem selection will be updated, if such feature is supported by current editor.
setSelection in interface CaretstartOffset - start selection offsetendPosition - end visual position of the text range to select (null argument means that
                        no specific visual position should be used)endOffset - end selection offsetpublic void setSelection(VisualPosition startPosition, int startOffset, VisualPosition endPosition, int endOffset)
CaretSystem selection will be updated, if such feature is supported by current editor.
setSelection in interface CaretstartPosition - start visual position of the text range to select (null argument means that
                        no specific visual position should be used)startOffset - start selection offsetendPosition - end visual position of the text range to select (null argument means that
                        no specific visual position should be used)endOffset - end selection offsetpublic void setSelection(VisualPosition startPosition, int startOffset, VisualPosition endPosition, int endOffset, boolean updateSystemSelection)
CaretsetSelection in interface CaretstartPosition - start visual position of the text range to select (null argument means that
                        no specific visual position should be used)startOffset - start selection offsetendPosition - end visual position of the text range to select (null argument means that
                        no specific visual position should be used)endOffset - end selection offsetupdateSystemSelection - whether system selection should be updated (might not have any effect if current editor doesn't support such a feature)public void removeSelection()
CaretremoveSelection in interface Caretpublic int getLeadSelectionOffset()
CaretgetLeadSelectionOffset in interface Caretpublic VisualPosition getLeadSelectionPosition()
getLeadSelectionPosition in interface Caretpublic void selectLineAtCaret()
CaretselectLineAtCaret in interface Caretpublic void selectWordAtCaret(boolean honorCamelWordsSettings)
CaretselectWordAtCaret in interface CarethonorCamelWordsSettings - if true and "Use CamelHumps words" is enabled,
                                upper-case letters within the word are considered as
                                boundaries for the range of text to select.public java.lang.String getSelectedText()
CaretgetSelectedText in interface Caretpublic EditorImpl getEditor()
Caretpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isAtRtlLocation()
Carettrue if caret is located in RTL text fragment. In that case visual column number is inversely related
 to offset and logical column number in the vicinity of caret.isAtRtlLocation in interface Caretpublic boolean isAtBidiRunBoundary()
Carettrue if caret is located at a boundary between different runs of bidirectional text.
 This means that text fragments at different sides of the boundary are non-adjacent in logical order.
 Caret can located at any side of the boundary, 
 exact location can be determined from directionality flags of caret's logical and visual position 
 (LogicalPosition.leansForward and VisualPosition.leansRight).isAtBidiRunBoundary in interface Caretpublic CaretVisualAttributes getVisualAttributes()
CaretgetVisualAttributes in interface CaretCaret.setVisualAttributes(CaretVisualAttributes)public void setVisualAttributes(CaretVisualAttributes attributes)
CaretsetVisualAttributes in interface CaretCaret.getVisualAttributes()public boolean isInVirtualSpace()
public void validateState()