public final class EditorImpl extends UserDataHolderBase implements EditorEx, HighlighterClient, Queryable, Dumpable, CodeStyleSettingsListener, java.awt.event.FocusListener
| Modifier and Type | Class and Description |
|---|---|
static class |
EditorImpl.CaretRectangle |
Queryable.Contributor, Queryable.PrintInfo, Queryable.Util| Modifier and Type | Field and Description |
|---|---|
static Key<java.lang.Boolean> |
DISABLE_CARET_POSITION_KEEPING |
static Key<java.lang.Boolean> |
FORCED_SOFT_WRAPS |
boolean |
myDisableRtl |
java.lang.Object |
myFractionalMetricsHintValue |
static Key<java.lang.Boolean> |
SOFT_WRAPS_EXIST |
static int |
TEXT_ALIGNMENT_LEFT |
static int |
TEXT_ALIGNMENT_RIGHT |
LAST_PASTED_REGION, PROP_COLUMN_MODE, PROP_FONT_SIZE, PROP_INSERT_MODE, VERTICAL_SCROLLBAR_LEFT, VERTICAL_SCROLLBAR_RIGHTEMPTY_ARRAY| Modifier and Type | Method and Description |
|---|---|
void |
addEditorMouseListener(EditorMouseListener listener)
Adds a listener for receiving notifications about mouse clicks in the editor and
the mouse entering/exiting the editor.
|
void |
addEditorMouseMotionListener(EditorMouseMotionListener listener)
Adds a listener for receiving notifications about mouse movement in the editor.
|
void |
addFocusListener(FocusChangeListener listener) |
void |
addFocusListener(FocusChangeListener listener,
Disposable parentDisposable) |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener,
Disposable parentDisposable) |
void |
applyFocusMode() |
void |
codeStyleSettingsChanged(CodeStyleSettingsChangeEvent event) |
EditorColorsScheme |
createBoundColorSchemeDelegate(EditorColorsScheme customGlobalScheme)
Creates color scheme delegate which is bound to current editor.
|
java.lang.String |
dumpState() |
int |
findNearestDirectionBoundary(int offset,
boolean lookForward) |
void |
focusGained(java.awt.event.FocusEvent e) |
void |
focusLost(java.awt.event.FocusEvent e) |
int |
getAscent()
Vertical distance, in pixels, between the top of visual line (corresponding coordinate is returned by
Editor.visualLineToY(int),
Editor.visualPositionToXY(VisualPosition), etc) and baseline of text in that visual line. |
java.awt.Color |
getBackgroundColor() |
EditorImpl.CaretRectangle [] |
getCaretLocations(boolean onlyIfShown) |
CaretModelImpl |
getCaretModel()
Returns the caret model for the document, which can be used to add and remove carets to the editor, as well as to query and update
carets' and corresponding selections' positions.
|
int |
getCharHeight() |
EditorColorsScheme |
getColorsScheme()
Returns the editor color scheme for this editor instance.
|
javax.swing.JComponent |
getComponent()
Returns the component for the entire editor including the scrollbars, error stripe, gutter
and other decorations.
|
TextRange |
getComposedTextRange() |
EditorComponentImpl |
getContentComponent()
Returns the component for the content area of the editor (the area displaying the document text).
|
java.awt.Dimension |
getContentSize() |
java.lang.String |
getContextMenuGroupId()
Returns id of action group what will be used to construct context menu displayed by default editor popup handler on mouse right
button's click (
null value meaning no context menu). |
CopyProvider |
getCopyProvider() |
CutProvider |
getCutProvider() |
DataContext |
getDataContext() |
DeleteProvider |
getDeleteProvider() |
int |
getDescent() |
Disposable |
getDisposable() |
DocumentEx |
getDocument()
Returns the document edited or viewed in the editor.
|
EditorKind |
getEditorKind() |
int |
getExpectedCaretOffset() |
MarkupModelEx |
getFilteredDocumentMarkupModel()
Returns the markup model for the underlying Document.
|
FocusModeModel |
getFocusModeModel() |
Segment |
getFocusModeRange() |
FoldingModelImpl |
getFoldingModel()
Returns the folding model for the document, which can be used to add, remove, expand
or collapse folded regions in the document.
|
java.awt.FontMetrics |
getFontMetrics(int fontType) |
int |
getFontSize() |
EditorGutter |
getGutter()
Returns the gutter instance for the editor, which can be used to draw custom text annotations
in the gutter.
|
com.intellij.openapi.editor.impl.EditorGutterComponentImpl |
getGutterComponentEx() |
javax.swing.JComponent |
getHeaderComponent() |
EditorHighlighter |
getHighlighter() |
IndentsModel |
getIndentsModel() |
InlayModelImpl |
getInlayModel() |
java.awt.Insets |
getInsets() |
int |
getLineHeight()
Returns the height of a single line of text in the current editor font.
|
MarkupModelEx |
getMarkupModel()
Returns the markup model for the editor.
|
int |
getMaxWidthInRange(int startOffset,
int endOffset) |
EditorMouseEventArea |
getMouseEventArea(java.awt.event.MouseEvent e)
Returns the editor area (text, gutter, folding outline and so on) in which the specified
mouse event occurred.
|
PasteProvider |
getPasteProvider() |
javax.swing.JComponent |
getPermanentHeaderComponent() |
java.lang.CharSequence |
getPlaceholder() |
TextAttributes |
getPlaceholderAttributes() |
int |
getPreferredHeight() |
java.awt.Dimension |
getPreferredSize() |
int |
getPrefixTextWidthInPixels() |
Project |
getProject()
Returns the project to which the editor is related.
|
float |
getScale()
Returns how much current line height bigger than the normal (16px)
This method is used to scale editors elements such as gutter icons, folding elements, and others
|
ScrollingModelEx |
getScrollingModel()
Returns the scrolling model for the document, which can be used to scroll the document
and retrieve information about the current position of the scrollbars.
|
javax.swing.JScrollPane |
getScrollPane() |
SelectionModelImpl |
getSelectionModel()
Returns the selection model for the editor, which can be used to select ranges of text in
the document and retrieve information about the selection.
|
EditorSettings |
getSettings()
Returns the editor settings for this editor instance.
|
boolean |
getShowPlaceholderWhenFocused() |
SoftWrapModelImpl |
getSoftWrapModel()
Returns the soft wrap model for the document, which can be used to get information about soft wraps registered
for the editor document at the moment and provides basic management functions for them.
|
TextDrawingCallback |
getTextDrawingCallback() |
int |
getVerticalScrollbarOrientation() |
VirtualFile |
getVirtualFile() |
int |
getVisibleLineCount() |
boolean |
hasHeaderComponent() |
void |
hideCursor() |
void |
installPopupHandler(EditorPopupHandler popupHandler)
Allows to override default editor's context popup logic.
|
boolean |
isColumnMode()
Returns the block selection mode for the editor.
|
boolean |
isDisposed()
Checks if this editor instance has been disposed.
|
boolean |
isDumb() |
boolean |
isEmbeddedIntoDialogWrapper() |
boolean |
isInDistractionFreeMode() |
boolean |
isInFocusMode(FoldRegion region) |
boolean |
isInsertMode()
Returns the insert/overwrite mode for the editor.
|
boolean |
isMirrored() |
boolean |
isOneLineMode()
Checks if the current editor instance is a one-line editor (used in a dialog control, for example).
|
boolean |
isPaintSelection() |
boolean |
isProcessingTypedAction() |
boolean |
isPurePaintingMode() |
boolean |
isRendererMode() |
boolean |
isRightAligned() |
boolean |
isScrollToCaret() |
boolean |
isStickySelection()
Allows to answer if 'sticky selection' is active for the current editor.
|
boolean |
isViewer()
Returns the value indicating whether the editor operates in viewer mode, with
all modification actions disabled.
|
int |
logicalPositionToOffset(LogicalPosition pos)
Maps a logical position in the editor to the offset in the document.
|
java.awt.Point |
logicalPositionToXY(LogicalPosition pos)
Maps a logical position in the editor to pixel coordinates.
|
VisualPosition |
logicalToVisualPosition(LogicalPosition logicalPos)
Maps a logical position in the editor (the line and column ignoring folding) to
a visual position (with folded lines and columns not included in the line and column count).
|
LogicalPosition |
offsetToLogicalPosition(int offset)
Maps an offset in the document to a logical position.
|
java.awt.geom.Point2D |
offsetToPoint2D(int offset,
boolean leanTowardsLargerOffsets,
boolean beforeSoftWrap) |
int |
offsetToVisualColumnInFoldRegion(FoldRegion region,
int offset,
boolean leanTowardsLargerOffsets) |
int |
offsetToVisualLine(int offset) |
VisualPosition |
offsetToVisualPosition(int offset)
Maps an offset in the document to visual position.
|
VisualPosition |
offsetToVisualPosition(int offset,
boolean leanForward,
boolean beforeSoftWrap)
Maps an offset in the document to visual position.
|
java.awt.Point |
offsetToXY(int offset,
boolean leanForward,
boolean beforeSoftWrap) |
boolean |
processKeyTyped(java.awt.event.KeyEvent e) |
boolean |
processLineExtensions(int line,
Processor<? super LineExtensionInfo> processor) |
void |
putInfo(java.util.Map<java.lang.String,java.lang.String> info) |
void |
recordLatencyAwareAction(java.lang.String actionId,
long timestampMs) |
void |
registerLineExtensionPainter(java.util.function.IntFunction<java.util.Collection<LineExtensionInfo>> lineExtensionPainter)
Registers a function which will be applied to a line number to obtain additional text fragments.
|
void |
registerScrollBarRepaintCallback(ButtonlessScrollBarUI.ScrollbarRepaintCallback callback)
Allows to register a callback that will be called one each repaint of the editor vertical scrollbar.
|
void |
reinitSettings() |
void |
removeEditorMouseListener(EditorMouseListener listener)
Removes a listener for receiving notifications about mouse clicks in the editor and
the mouse entering/exiting the editor.
|
void |
removeEditorMouseMotionListener(EditorMouseMotionListener listener)
Removes a listener for receiving notifications about mouse movement in the editor.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
repaint(int startOffset,
int endOffset) |
void |
resetSizes() |
void |
setBackgroundColor(java.awt.Color color) |
void |
setBorder(javax.swing.border.Border border) |
void |
setCaretActive() |
boolean |
setCaretEnabled(boolean enabled) |
boolean |
setCaretVisible(boolean b) |
void |
setColorsScheme(EditorColorsScheme scheme) |
void |
setColumnMode(boolean mode) |
void |
setContextMenuGroupId(java.lang.String groupId)
Sets id of action group what will be used to construct context menu displayed by default editor popup handler on mouse right button's
click (with
null value disabling context menu). |
void |
setCustomCursor(java.lang.Object requestor,
java.awt.Cursor cursor)
If
cursor parameter value is not null, sets custom cursor to editor's content component,
otherwise restores default editor cursor management logic (requestor parameter value should be the same in both setting and
restoring requests). |
void |
setDropHandler(EditorDropHandler dropHandler) |
void |
setEmbeddedIntoDialogWrapper(boolean b) |
void |
setFile(VirtualFile vFile) |
void |
setFontSize(int fontSize) |
void |
setHeaderComponent(javax.swing.JComponent header)
Set up a header component for this text editor.
|
void |
setHighlighter(EditorHighlighter highlighter) |
void |
setHighlightingFilter(Condition<RangeHighlighter> filter) |
void |
setHorizontalScrollbarVisible(boolean b) |
void |
setHorizontalTextAlignment(int alignment) |
void |
setInsertMode(boolean mode) |
void |
setOneLineMode(boolean isOneLineMode) |
void |
setPaintSelection(boolean paintSelection) |
void |
setPermanentHeaderComponent(javax.swing.JComponent component) |
void |
setPlaceholder(java.lang.CharSequence text)
Allows to define
'placeholder text' for the current editor, i.e. |
void |
setPlaceholderAttributes(TextAttributes attributes)
Sets text attributes for a placeholder.
|
void |
setPrefixTextAndAttributes(java.lang.String prefixText,
TextAttributes attributes)
Allows to define prefix to be displayed on every editor line and text attributes to use for its coloring.
|
void |
setPurePaintingMode(boolean enabled)
We often re-use the logic encapsulated at the editor.
|
void |
setRendererMode(boolean isRendererMode) |
void |
setScrollToCaret(boolean scrollToCaret) |
void |
setShowPlaceholderWhenFocused(boolean show)
Controls whether
'placeholder text' is visible when editor is focused. |
void |
setStickySelection(boolean enable)
Allows to set current
sticky selection mode. |
void |
setUseEditorAntialiasing(boolean value) |
void |
setVerticalScrollbarOrientation(int type) |
void |
setVerticalScrollbarVisible(boolean b) |
void |
setViewer(boolean isViewer)
shouldn't be called during Document update
|
boolean |
shouldSoftWrapsBeForced() |
void |
startDumb()
stopDumbLater() or stopDumb() must be performed in finally |
void |
stopDumbLater() |
void |
throwDisposalError(java.lang.String msg)
In case of "editor not disposed error" use
throwEditorNotDisposedError(String) |
ActionCallback |
type(java.lang.String text) |
void |
uninstallPopupHandler(EditorPopupHandler popupHandler)
Removes previously installed
EditorPopupHandler. |
int |
visualColumnToOffsetInFoldRegion(FoldRegion region,
int visualColumn,
boolean leansRight) |
int |
visualLineStartOffset(int visualLine) |
int |
visualLineToY(int line) |
java.awt.geom.Point2D |
visualPositionToPoint2D(VisualPosition visible)
Same as
Editor.visualPositionToXY(VisualPosition), but returns potentially more precise result. |
java.awt.Point |
visualPositionToXY(VisualPosition visible)
Maps a visual position in the editor to pixel coordinates.
|
LogicalPosition |
visualToLogicalPosition(VisualPosition visiblePos)
Maps a visual position in the editor (with folded lines and columns not included in the line and column count) to
a logical position (the line and column ignoring folding).
|
LogicalPosition |
xyToLogicalPosition(java.awt.Point p)
Maps the pixel coordinates in the editor to a logical position.
|
VisualPosition |
xyToVisualPosition(java.awt.Point p)
Maps the pixel coordinates in the editor to a visual position.
|
VisualPosition |
xyToVisualPosition(java.awt.geom.Point2D p)
Same as {
Editor.xyToVisualPosition(Point)}, but allows to specify target point with higher precision. |
int |
yToVisualLine(int y) |
changeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMapequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddEditorMouseListener, addEditorMouseMotionListener, offsetToPoint2D, offsetToXYgetUserData, putUserDatapublic static final int TEXT_ALIGNMENT_LEFT
public static final int TEXT_ALIGNMENT_RIGHT
public static final Key<java.lang.Boolean> FORCED_SOFT_WRAPS
public static final Key<java.lang.Boolean> SOFT_WRAPS_EXIST
public static final Key<java.lang.Boolean> DISABLE_CARET_POSITION_KEEPING
public final boolean myDisableRtl
public final java.lang.Object myFractionalMetricsHintValue
public void applyFocusMode()
public boolean isInFocusMode(FoldRegion region)
public Segment getFocusModeRange()
public FocusModeModel getFocusModeModel()
public void focusGained(java.awt.event.FocusEvent e)
focusGained in interface java.awt.event.FocusListenerpublic void focusLost(java.awt.event.FocusEvent e)
focusLost in interface java.awt.event.FocusListenerpublic boolean shouldSoftWrapsBeForced()
public EditorColorsScheme createBoundColorSchemeDelegate(EditorColorsScheme customGlobalScheme)
EditorExcreateBoundColorSchemeDelegate in interface EditorExpublic int getPrefixTextWidthInPixels()
getPrefixTextWidthInPixels in interface EditorExprefix used with the current editor if any;
zero otherwisepublic void setPrefixTextAndAttributes(java.lang.String prefixText,
TextAttributes attributes)
EditorExsetPrefixTextAndAttributes in interface EditorExprefixText - target prefix textattributes - text attributes to use during given prefix paintingpublic boolean isPurePaintingMode()
isPurePaintingMode in interface EditorExEditorEx.setPurePaintingMode(boolean)public void setPurePaintingMode(boolean enabled)
EditorExThe thing is that the editor itself may change its state if any postponed operation is triggered by the painting request (e.g. soft wraps recalculation is triggered by the paint request and newly calculated soft wraps cause caret to change its position).
This method allows to inform the editor that all subsequent painting request should not change the editor state.
In 'pure painting mode' editor also behaves as if soft wraps were not enabled.
setPurePaintingMode in interface EditorExenabled - 'pure painting mode' status to usepublic void registerLineExtensionPainter(java.util.function.IntFunction<java.util.Collection<LineExtensionInfo>> lineExtensionPainter)
EditorExEditorLinePainter extensions).registerLineExtensionPainter in interface EditorExpublic boolean processLineExtensions(int line,
Processor<? super LineExtensionInfo> processor)
public void registerScrollBarRepaintCallback(ButtonlessScrollBarUI.ScrollbarRepaintCallback callback)
EditorExAnimator to draw itself.registerScrollBarRepaintCallback in interface EditorExcallback - callback which will be called from the JComponent.paint(Graphics) method of
the editor vertical scrollbar.public int getExpectedCaretOffset()
getExpectedCaretOffset in interface EditorExEditorMouseListener.mousePressed(EditorMouseEvent) implementation, as at the time this method is invoked caret wasn't yet moved
to the press position. In other circumstances it's just equal to primary caret's offset.public void setContextMenuGroupId(java.lang.String groupId)
EditorExnull value disabling context menu). This method might have no effect if default editor's popup handler was
overridden using EditorEx.installPopupHandler(EditorPopupHandler).setContextMenuGroupId in interface EditorExEditorEx.getContextMenuGroupId()public java.lang.String getContextMenuGroupId()
EditorExnull value meaning no context menu). Returned value might be meaningless if default editor's popup handler
was overridden using EditorEx.installPopupHandler(EditorPopupHandler).getContextMenuGroupId in interface EditorExEditorEx.setContextMenuGroupId(String)public void installPopupHandler(EditorPopupHandler popupHandler)
EditorEx
Default handler shows a context menu corresponding to a certain action group
registered in ActionManager. Group's id can be changed using EditorEx.setContextMenuGroupId(String). For inline custom visual
elements (inlays) action group is determined by EditorCustomElementRenderer.getContextMenuGroupId(Inlay) and
EditorCustomElementRenderer.getContextMenuGroup(Inlay).
If multiple handlers are installed, they are processed in order, starting from the most recently installed one. Processing stops when
some handler returns true from EditorPopupHandler.handlePopup(EditorMouseEvent) method.
installPopupHandler in interface EditorExEditorEx.uninstallPopupHandler(EditorPopupHandler)public void uninstallPopupHandler(EditorPopupHandler popupHandler)
EditorExEditorPopupHandler.uninstallPopupHandler in interface EditorExEditorEx.installPopupHandler(EditorPopupHandler)public void setCustomCursor(java.lang.Object requestor,
java.awt.Cursor cursor)
EditorExcursor parameter value is not null, sets custom cursor to editor's content component,
otherwise restores default editor cursor management logic (requestor parameter value should be the same in both setting and
restoring requests). 'Restoring' call for a requestor, which hasn't set a cursor previously, has no effect. If multiple requestors have
currently set custom cursors, one of them will be used (it is unspecified, which one).setCustomCursor in interface EditorExpublic void setViewer(boolean isViewer)
EditorExpublic boolean isViewer()
Editorpublic boolean isRendererMode()
isRendererMode in interface EditorExpublic void setRendererMode(boolean isRendererMode)
setRendererMode in interface EditorExpublic void setFile(VirtualFile vFile)
public VirtualFile getVirtualFile()
getVirtualFile in interface EditorExpublic SelectionModelImpl getSelectionModel()
Editor
To query or change selections for specific carets, CaretModel interface should be used.
getSelectionModel in interface EditorEditor.getCaretModel()public MarkupModelEx getMarkupModel()
Editor
See also DocumentMarkupModel.forDocument(Document, Project, boolean)
EditorEx.getFilteredDocumentMarkupModel().
getMarkupModel in interface EditorgetMarkupModel in interface EditorExpublic MarkupModelEx getFilteredDocumentMarkupModel()
EditorExThis model differs from the one from DocumentMarkupModel#forDocument, as it does not contain highlighters that should not be visible in this Editor. (for example, debugger breakpoints in a diff viewer editors)
getFilteredDocumentMarkupModel in interface EditorExMarkupEditorFilter,
setHighlightingFilter(Condition),
DocumentMarkupModel.forDocument(Document, Project, boolean)public FoldingModelImpl getFoldingModel()
EditorgetFoldingModel in interface EditorgetFoldingModel in interface EditorExpublic CaretModelImpl getCaretModel()
EditorgetCaretModel in interface Editorpublic ScrollingModelEx getScrollingModel()
EditorgetScrollingModel in interface EditorgetScrollingModel in interface EditorExpublic SoftWrapModelImpl getSoftWrapModel()
EditorgetSoftWrapModel in interface EditorgetSoftWrapModel in interface EditorExpublic InlayModelImpl getInlayModel()
getInlayModel in interface Editorpublic EditorKind getEditorKind()
getEditorKind in interface Editorpublic EditorSettings getSettings()
EditorgetSettings in interface Editorpublic void resetSizes()
public void reinitSettings()
reinitSettings in interface EditorExpublic void throwDisposalError(java.lang.String msg)
throwEditorNotDisposedError(String)public void setFontSize(int fontSize)
setFontSize in interface EditorExpublic int getFontSize()
public ActionCallback type(java.lang.String text)
public void setHighlighter(EditorHighlighter highlighter)
setHighlighter in interface EditorExpublic EditorHighlighter getHighlighter()
getHighlighter in interface EditorExpublic EditorComponentImpl getContentComponent()
EditorDataProvider.getContentComponent in interface Editorpublic com.intellij.openapi.editor.impl.EditorGutterComponentImpl getGutterComponentEx()
getGutterComponentEx in interface EditorExpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener in interface EditorExpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener,
Disposable parentDisposable)
addPropertyChangeListener in interface EditorExpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener in interface EditorExpublic void setInsertMode(boolean mode)
setInsertMode in interface EditorExpublic boolean isInsertMode()
EditorisInsertMode in interface Editortrue if the editor is in insert mode, false otherwise.public void setColumnMode(boolean mode)
setColumnMode in interface EditorExpublic boolean isColumnMode()
EditorisColumnMode in interface Editortrue if the editor uses column selection, false if it uses regular selection.public int yToVisualLine(int y)
yToVisualLine in interface Editorpublic VisualPosition xyToVisualPosition(java.awt.Point p)
EditorxyToVisualPosition in interface Editorp - the coordinates relative to the top left corner of the content component.public VisualPosition xyToVisualPosition(java.awt.geom.Point2D p)
EditorEditor.xyToVisualPosition(Point)}, but allows to specify target point with higher precision.xyToVisualPosition in interface Editorpublic java.awt.geom.Point2D offsetToPoint2D(int offset,
boolean leanTowardsLargerOffsets,
boolean beforeSoftWrap)
offsetToPoint2D in interface EditorEditor.offsetToVisualPosition(int, boolean, boolean)public java.awt.Point offsetToXY(int offset,
boolean leanForward,
boolean beforeSoftWrap)
offsetToXY in interface EditorEditor.offsetToVisualPosition(int, boolean, boolean)public VisualPosition offsetToVisualPosition(int offset)
Editor
It's assumed that original position is associated with the character immediately preceding given offset,
leansRight value for visual position will be determined correspondingly.
If there's a soft wrap at the given offset, visual position on a line following the wrap will be returned.
offsetToVisualPosition in interface Editoroffset - the offset in the document.public VisualPosition offsetToVisualPosition(int offset, boolean leanForward, boolean beforeSoftWrap)
EditoroffsetToVisualPosition in interface Editoroffset - the offset in the document.leanForward - if true, original position is associated with character after given offset, if false -
with character before given offset. This can make a difference in bidirectional text (see LogicalPosition,
VisualPosition)beforeSoftWrap - if true, visual position at line preceeding the wrap will be returned, otherwise - visual position
at line following the wrap.public int offsetToVisualColumnInFoldRegion(FoldRegion region, int offset, boolean leanTowardsLargerOffsets)
public int visualColumnToOffsetInFoldRegion(FoldRegion region, int visualColumn, boolean leansRight)
public LogicalPosition offsetToLogicalPosition(int offset)
Editor
It's assumed that original position is associated with character immediately preceding given offset, so target logical position will
have leansForward value set to false.
offsetToLogicalPosition in interface Editoroffset - the offset in the document.public void setCaretActive()
public int offsetToVisualLine(int offset)
public int visualLineStartOffset(int visualLine)
public LogicalPosition xyToLogicalPosition(java.awt.Point p)
EditorxyToLogicalPosition in interface Editorp - the coordinates relative to the top left corner of the content component.public java.awt.Point logicalPositionToXY(LogicalPosition pos)
EditorlogicalPositionToXY in interface Editorpos - the logical position.content component.public java.awt.Point visualPositionToXY(VisualPosition visible)
EditorvisualPositionToXY in interface Editorvisible - the visual position.content component.public java.awt.geom.Point2D visualPositionToPoint2D(VisualPosition visible)
EditorEditor.visualPositionToXY(VisualPosition), but returns potentially more precise result.visualPositionToPoint2D in interface Editorpublic float getScale()
public int findNearestDirectionBoundary(int offset,
boolean lookForward)
public int visualLineToY(int line)
visualLineToY in interface Editorpublic void repaint(int startOffset,
int endOffset)
repaint in interface EditorExrepaint in interface HighlighterClientpublic void hideCursor()
public boolean isScrollToCaret()
public void setScrollToCaret(boolean scrollToCaret)
public Disposable getDisposable()
public DocumentEx getDocument()
EditorgetDocument in interface EditorgetDocument in interface EditorExgetDocument in interface HighlighterClientpublic javax.swing.JComponent getComponent()
EditorgetComponent in interface Editorpublic void addEditorMouseListener(EditorMouseListener listener)
EditoraddEditorMouseListener in interface Editorlistener - the listener instance.public void removeEditorMouseListener(EditorMouseListener listener)
EditorremoveEditorMouseListener in interface Editorlistener - the listener instance.public void addEditorMouseMotionListener(EditorMouseMotionListener listener)
EditoraddEditorMouseMotionListener in interface Editorlistener - the listener instance.public void removeEditorMouseMotionListener(EditorMouseMotionListener listener)
EditorremoveEditorMouseMotionListener in interface Editorlistener - the listener instance.public boolean isStickySelection()
EditorExEditorEx.setStickySelection(boolean) call with 'true' argument.isStickySelection in interface EditorExtrue if 'sticky selection' mode is active at the current editor; false otherwisepublic void setStickySelection(boolean enable)
EditorExsticky selection mode.setStickySelection in interface EditorExenable - flag that identifies if 'sticky selection' mode should be enabledpublic void setHorizontalTextAlignment(int alignment)
public boolean isRightAligned()
public boolean isDisposed()
EditorisDisposed in interface Editortrue if the editor has been disposed, false otherwise.public void stopDumbLater()
public void startDumb()
stopDumbLater() or stopDumb() must be performed in finallypublic boolean isDumb()
public IndentsModel getIndentsModel()
getIndentsModel in interface Editorpublic void setHeaderComponent(javax.swing.JComponent header)
EditorsetHeaderComponent in interface Editorheader - a component to setup as header for this text editor or null to remove existing one.public boolean hasHeaderComponent()
hasHeaderComponent in interface Editortrue if this editor has active header component set up by Editor.setHeaderComponent(JComponent)public javax.swing.JComponent getPermanentHeaderComponent()
getPermanentHeaderComponent in interface EditorExpublic void setPermanentHeaderComponent(javax.swing.JComponent component)
setPermanentHeaderComponent in interface EditorExpublic javax.swing.JComponent getHeaderComponent()
getHeaderComponent in interface EditorEditor.setHeaderComponent(JComponent) or null if no header currently installed.public void setBackgroundColor(java.awt.Color color)
setBackgroundColor in interface EditorExpublic java.awt.Color getBackgroundColor()
getBackgroundColor in interface EditorExpublic TextDrawingCallback getTextDrawingCallback()
getTextDrawingCallback in interface EditorExpublic void setPlaceholder(java.lang.CharSequence text)
EditorEx'placeholder text' for the current editor, i.e. virtual text that will be represented until
any user data is entered.
Feel free to see the detailed feature
definition here.setPlaceholder in interface EditorExtext - virtual text to show until user data is entered or the editor is focusedpublic void setPlaceholderAttributes(TextAttributes attributes)
EditorExnull means default values should be used.setPlaceholderAttributes in interface EditorExEditorEx.setPlaceholder(CharSequence)public TextAttributes getPlaceholderAttributes()
public java.lang.CharSequence getPlaceholder()
public void setShowPlaceholderWhenFocused(boolean show)
EditorEx'placeholder text' is visible when editor is focused.setShowPlaceholderWhenFocused in interface EditorExshow - flag indicating whether placeholder is visible when editor is focused.EditorEx.setPlaceholder(CharSequence)public boolean getShowPlaceholderWhenFocused()
public TextRange getComposedTextRange()
public int getMaxWidthInRange(int startOffset,
int endOffset)
getMaxWidthInRange in interface EditorExpublic boolean isPaintSelection()
public void setPaintSelection(boolean paintSelection)
public EditorImpl.CaretRectangle [] getCaretLocations(boolean onlyIfShown)
public int getAscent()
EditorEditor.visualLineToY(int),
Editor.visualPositionToXY(VisualPosition), etc) and baseline of text in that visual line.public int getLineHeight()
EditorgetLineHeight in interface Editorpublic int getDescent()
public int getCharHeight()
public java.awt.FontMetrics getFontMetrics(int fontType)
public int getPreferredHeight()
public java.awt.Dimension getPreferredSize()
public java.awt.Dimension getContentSize()
getContentSize in interface EditorExpublic javax.swing.JScrollPane getScrollPane()
getScrollPane in interface EditorExpublic void setBorder(javax.swing.border.Border border)
public int logicalPositionToOffset(LogicalPosition pos)
EditorlogicalPositionToOffset in interface Editorpos - the logical position.public int getVisibleLineCount()
public VisualPosition logicalToVisualPosition(LogicalPosition logicalPos)
EditorlogicalToVisualPosition in interface EditorlogicalPos - the logical position.public LogicalPosition visualToLogicalPosition(VisualPosition visiblePos)
EditorvisualToLogicalPosition in interface EditorvisiblePos - the visual position.public DataContext getDataContext()
getDataContext in interface EditorExpublic EditorMouseEventArea getMouseEventArea(java.awt.event.MouseEvent e)
EditorgetMouseEventArea in interface Editore - the mouse event for which the area is requested.null if the event occurred over an unknown area.public boolean setCaretVisible(boolean b)
setCaretVisible in interface EditorExpublic boolean setCaretEnabled(boolean enabled)
setCaretEnabled in interface EditorExpublic void addFocusListener(FocusChangeListener listener)
addFocusListener in interface EditorExpublic void addFocusListener(FocusChangeListener listener, Disposable parentDisposable)
addFocusListener in interface EditorExpublic Project getProject()
EditorgetProject in interface EditorgetProject in interface HighlighterClientnull if the editor is not related to any project.public boolean isOneLineMode()
EditorisOneLineMode in interface Editortrue if the editor is one-line, false otherwise.public boolean isEmbeddedIntoDialogWrapper()
isEmbeddedIntoDialogWrapper in interface EditorExpublic void setEmbeddedIntoDialogWrapper(boolean b)
setEmbeddedIntoDialogWrapper in interface EditorExpublic void setOneLineMode(boolean isOneLineMode)
setOneLineMode in interface EditorExpublic CopyProvider getCopyProvider()
getCopyProvider in interface EditorExpublic CutProvider getCutProvider()
getCutProvider in interface EditorExpublic PasteProvider getPasteProvider()
getPasteProvider in interface EditorExpublic DeleteProvider getDeleteProvider()
getDeleteProvider in interface EditorExpublic void setColorsScheme(EditorColorsScheme scheme)
setColorsScheme in interface EditorExpublic EditorColorsScheme getColorsScheme()
EditorgetColorsScheme in interface Editorpublic void setVerticalScrollbarOrientation(int type)
setVerticalScrollbarOrientation in interface EditorExpublic void setVerticalScrollbarVisible(boolean b)
setVerticalScrollbarVisible in interface EditorExpublic void setHorizontalScrollbarVisible(boolean b)
setHorizontalScrollbarVisible in interface EditorExpublic int getVerticalScrollbarOrientation()
getVerticalScrollbarOrientation in interface EditorExpublic boolean isMirrored()
public boolean processKeyTyped(java.awt.event.KeyEvent e)
processKeyTyped in interface EditorExpublic void recordLatencyAwareAction(java.lang.String actionId,
long timestampMs)
public boolean isProcessingTypedAction()
public void setDropHandler(EditorDropHandler dropHandler)
public void setHighlightingFilter(Condition<RangeHighlighter> filter)
public void setUseEditorAntialiasing(boolean value)
public EditorGutter getGutter()
Editorpublic boolean isInDistractionFreeMode()
public void putInfo(java.util.Map<java.lang.String,java.lang.String> info)
public void codeStyleSettingsChanged(CodeStyleSettingsChangeEvent event)
codeStyleSettingsChanged in interface CodeStyleSettingsListener