public class TextComponentEditorImpl extends UserDataHolderBase implements TextComponentEditor
EMPTY_ARRAY| Constructor and Description |
|---|
TextComponentEditorImpl(Project project,
javax.swing.text.JTextComponent textComponent) |
| 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.
|
CaretModel |
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.
|
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.
|
javax.swing.text.JTextComponent |
getContentComponent()
Returns the component for the content area of the editor (the area displaying the document text).
|
Document |
getDocument()
Returns the document edited or viewed in the editor.
|
EditorKind |
getEditorKind() |
FoldingModel |
getFoldingModel()
Returns the folding model for the document, which can be used to add, remove, expand
or collapse folded regions in the document.
|
EditorGutter |
getGutter()
Returns the gutter instance for the editor, which can be used to draw custom text annotations
in the gutter.
|
javax.swing.JComponent |
getHeaderComponent() |
IndentsModel |
getIndentsModel() |
InlayModel |
getInlayModel() |
java.awt.Insets |
getInsets() |
int |
getLineHeight()
Returns the height of a single line of text in the current editor font.
|
MarkupModel |
getMarkupModel()
Returns the markup model for the editor.
|
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.
|
Project |
getProject()
Returns the project to which the editor is related.
|
ScrollingModel |
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.
|
com.intellij.openapi.editor.textarea.TextComponentSelectionModel |
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.
|
SoftWrapModel |
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.
|
boolean |
hasHeaderComponent() |
boolean |
isColumnMode()
Returns the block selection mode for the editor.
|
boolean |
isDisposed()
Checks if this editor instance has been disposed.
|
boolean |
isInsertMode()
Returns the insert/overwrite mode for the editor.
|
boolean |
isOneLineMode()
Checks if the current editor instance is a one-line editor (used in a dialog control, for example).
|
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.
|
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.
|
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 |
setBorder(javax.swing.border.Border border) |
void |
setHeaderComponent(javax.swing.JComponent header)
Set up a header component for this text editor.
|
java.awt.geom.Point2D |
visualPositionToPoint2D(VisualPosition pos)
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. |
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, getAscent, offsetToPoint2D, offsetToPoint2D, offsetToXY, offsetToXY, visualLineToY, yToVisualLinegetUserData, putUserDatapublic TextComponentEditorImpl(Project project, javax.swing.text.JTextComponent textComponent)
public Document getDocument()
EditorgetDocument in interface Editorpublic boolean isViewer()
Editorpublic javax.swing.JComponent getComponent()
EditorgetComponent in interface Editorpublic javax.swing.text.JTextComponent getContentComponent()
EditorDataProvider.getContentComponent in interface Editorpublic void setBorder(javax.swing.border.Border border)
public com.intellij.openapi.editor.textarea.TextComponentSelectionModel getSelectionModel()
Editor
To query or change selections for specific carets, CaretModel interface should be used.
getSelectionModel in interface EditorEditor.getCaretModel()public MarkupModel getMarkupModel()
Editor
See also DocumentMarkupModel.forDocument(Document, Project, boolean)
EditorEx.getFilteredDocumentMarkupModel().
getMarkupModel in interface Editorpublic FoldingModel getFoldingModel()
EditorgetFoldingModel in interface Editorpublic ScrollingModel getScrollingModel()
EditorgetScrollingModel in interface Editorpublic CaretModel getCaretModel()
EditorgetCaretModel in interface Editorpublic SoftWrapModel getSoftWrapModel()
EditorgetSoftWrapModel in interface Editorpublic InlayModel getInlayModel()
getInlayModel in interface Editorpublic EditorKind getEditorKind()
getEditorKind in interface Editorpublic EditorSettings getSettings()
EditorgetSettings in interface Editorpublic EditorColorsScheme getColorsScheme()
EditorgetColorsScheme in interface Editorpublic int getLineHeight()
EditorgetLineHeight in interface Editorpublic java.awt.Point logicalPositionToXY(LogicalPosition pos)
EditorlogicalPositionToXY in interface Editorpos - the logical position.content component.public int logicalPositionToOffset(LogicalPosition pos)
EditorlogicalPositionToOffset in interface Editorpos - the logical position.public VisualPosition logicalToVisualPosition(LogicalPosition logicalPos)
EditorlogicalToVisualPosition in interface EditorlogicalPos - the logical position.public java.awt.Point visualPositionToXY(VisualPosition visible)
EditorvisualPositionToXY in interface Editorvisible - the visual position.content component.public java.awt.geom.Point2D visualPositionToPoint2D(VisualPosition pos)
EditorEditor.visualPositionToXY(VisualPosition), but returns potentially more precise result.visualPositionToPoint2D in interface Editorpublic LogicalPosition visualToLogicalPosition(VisualPosition visiblePos)
EditorvisualToLogicalPosition in interface EditorvisiblePos - the visual position.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 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 LogicalPosition xyToLogicalPosition(java.awt.Point p)
EditorxyToLogicalPosition in interface Editorp - the coordinates relative to the top left corner of the content component.public 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 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 isDisposed()
EditorisDisposed in interface Editortrue if the editor has been disposed, false otherwise.public Project getProject()
EditorgetProject in interface Editornull if the editor is not related to any project.public boolean isInsertMode()
EditorisInsertMode in interface Editortrue if the editor is in insert mode, false otherwise.public boolean isColumnMode()
EditorisColumnMode in interface Editortrue if the editor uses column selection, false if it uses regular selection.public boolean isOneLineMode()
EditorisOneLineMode in interface Editortrue if the editor is one-line, false otherwise.public EditorGutter getGutter()
Editorpublic 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 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 getHeaderComponent()
getHeaderComponent in interface EditorEditor.setHeaderComponent(JComponent) or null if no header currently installed.public IndentsModel getIndentsModel()
getIndentsModel in interface Editor