public interface EditorEx extends Editor
Modifier and Type | Field and Description |
---|---|
static Key<TextRange> |
LAST_PASTED_REGION |
static java.lang.String |
PROP_COLUMN_MODE |
static java.lang.String |
PROP_FONT_SIZE |
static java.lang.String |
PROP_INSERT_MODE |
static int |
VERTICAL_SCROLLBAR_LEFT |
static int |
VERTICAL_SCROLLBAR_RIGHT |
EMPTY_ARRAY
Modifier and Type | Method and Description |
---|---|
void |
addFocusListener(FocusChangeListener listener) |
void |
addFocusListener(FocusChangeListener listener,
Disposable parentDisposable) |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener,
Disposable parentDisposable) |
EditorColorsScheme |
createBoundColorSchemeDelegate(EditorColorsScheme customGlobalScheme)
Creates color scheme delegate which is bound to current editor.
|
java.awt.Color |
getBackgroundColor() |
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() |
DocumentEx |
getDocument()
Returns the document edited or viewed in the editor.
|
int |
getExpectedCaretOffset() |
MarkupModelEx |
getFilteredDocumentMarkupModel()
Returns the markup model for the underlying Document.
|
FoldingModelEx |
getFoldingModel()
Returns the folding model for the document, which can be used to add, remove, expand
or collapse folded regions in the document.
|
EditorGutterComponentEx |
getGutterComponentEx() |
EditorHighlighter |
getHighlighter() |
MarkupModelEx |
getMarkupModel()
Returns the markup model for the editor.
|
int |
getMaxWidthInRange(int startOffset,
int endOffset) |
PasteProvider |
getPasteProvider() |
javax.swing.JComponent |
getPermanentHeaderComponent() |
int |
getPrefixTextWidthInPixels() |
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() |
SoftWrapModelEx |
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() |
void |
installPopupHandler(EditorPopupHandler popupHandler)
Allows to override default editor's context popup logic.
|
boolean |
isEmbeddedIntoDialogWrapper() |
boolean |
isPurePaintingMode() |
boolean |
isRendererMode() |
boolean |
isStickySelection()
Allows to answer if 'sticky selection' is active for the current editor.
|
boolean |
processKeyTyped(java.awt.event.KeyEvent e) |
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 |
removePropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
repaint(int startOffset,
int endOffset) |
void |
setBackgroundColor(java.awt.Color color) |
boolean |
setCaretEnabled(boolean enabled) |
boolean |
setCaretVisible(boolean b) |
void |
setColorsScheme(EditorColorsScheme scheme) |
void |
setColumnMode(boolean val) |
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 |
setEmbeddedIntoDialogWrapper(boolean b) |
void |
setFile(VirtualFile vFile) |
void |
setFontSize(int fontSize) |
void |
setHighlighter(EditorHighlighter highlighter) |
void |
setHorizontalScrollbarVisible(boolean b) |
void |
setInsertMode(boolean val) |
void |
setOneLineMode(boolean b) |
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 |
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 |
setVerticalScrollbarOrientation(int type) |
void |
setVerticalScrollbarVisible(boolean b) |
void |
setViewer(boolean isViewer)
shouldn't be called during Document update
|
void |
uninstallPopupHandler(EditorPopupHandler popupHandler)
Removes previously installed
EditorPopupHandler . |
addEditorMouseListener, addEditorMouseListener, addEditorMouseMotionListener, addEditorMouseMotionListener, getAscent, getCaretModel, getColorsScheme, getComponent, getContentComponent, getEditorKind, getGutter, getHeaderComponent, getIndentsModel, getInlayModel, getInsets, getLineHeight, getMouseEventArea, getProject, getSelectionModel, getSettings, hasHeaderComponent, isColumnMode, isDisposed, isInsertMode, isOneLineMode, isViewer, logicalPositionToOffset, logicalPositionToXY, logicalToVisualPosition, offsetToLogicalPosition, offsetToPoint2D, offsetToPoint2D, offsetToVisualPosition, offsetToVisualPosition, offsetToXY, offsetToXY, removeEditorMouseListener, removeEditorMouseMotionListener, setBorder, setHeaderComponent, visualLineToY, visualPositionToPoint2D, visualPositionToXY, visualToLogicalPosition, xyToLogicalPosition, xyToVisualPosition, xyToVisualPosition, yToVisualLine
getUserData, putUserData
static final java.lang.String PROP_INSERT_MODE
static final java.lang.String PROP_COLUMN_MODE
static final java.lang.String PROP_FONT_SIZE
static final int VERTICAL_SCROLLBAR_LEFT
static final int VERTICAL_SCROLLBAR_RIGHT
DocumentEx getDocument()
Editor
getDocument
in interface Editor
MarkupModelEx getMarkupModel()
Editor
See also DocumentMarkupModel.forDocument(Document, Project, boolean)
getFilteredDocumentMarkupModel()
.
getMarkupModel
in interface Editor
MarkupModelEx getFilteredDocumentMarkupModel()
This 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)
MarkupEditorFilter
,
EditorImpl.setHighlightingFilter(Condition)
,
DocumentMarkupModel.forDocument(Document, Project, boolean)
EditorGutterComponentEx getGutterComponentEx()
EditorHighlighter getHighlighter()
javax.swing.JComponent getPermanentHeaderComponent()
void setViewer(boolean isViewer)
void setPermanentHeaderComponent(javax.swing.JComponent component)
void setHighlighter(EditorHighlighter highlighter)
void setColorsScheme(EditorColorsScheme scheme)
void setInsertMode(boolean val)
void setColumnMode(boolean val)
void setVerticalScrollbarOrientation(int type)
int getVerticalScrollbarOrientation()
void setVerticalScrollbarVisible(boolean b)
void setHorizontalScrollbarVisible(boolean b)
CutProvider getCutProvider()
CopyProvider getCopyProvider()
PasteProvider getPasteProvider()
DeleteProvider getDeleteProvider()
void repaint(int startOffset, int endOffset)
void reinitSettings()
void addPropertyChangeListener(java.beans.PropertyChangeListener listener, Disposable parentDisposable)
void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
int getMaxWidthInRange(int startOffset, int endOffset)
boolean setCaretVisible(boolean b)
boolean setCaretEnabled(boolean enabled)
void addFocusListener(FocusChangeListener listener)
void addFocusListener(FocusChangeListener listener, Disposable parentDisposable)
void setOneLineMode(boolean b)
javax.swing.JScrollPane getScrollPane()
boolean isRendererMode()
void setRendererMode(boolean isRendererMode)
void setFile(VirtualFile vFile)
DataContext getDataContext()
boolean processKeyTyped(java.awt.event.KeyEvent e)
void setFontSize(int fontSize)
java.awt.Color getBackgroundColor()
void setBackgroundColor(java.awt.Color color)
java.awt.Dimension getContentSize()
boolean isEmbeddedIntoDialogWrapper()
void setEmbeddedIntoDialogWrapper(boolean b)
VirtualFile getVirtualFile()
TextDrawingCallback getTextDrawingCallback()
FoldingModelEx getFoldingModel()
Editor
getFoldingModel
in interface Editor
SoftWrapModelEx getSoftWrapModel()
Editor
getSoftWrapModel
in interface Editor
ScrollingModelEx getScrollingModel()
Editor
getScrollingModel
in interface Editor
EditorColorsScheme createBoundColorSchemeDelegate(EditorColorsScheme customGlobalScheme)
void setPlaceholder(java.lang.CharSequence text)
'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.text
- virtual text to show until user data is entered or the editor is focusedvoid setPlaceholderAttributes(TextAttributes attributes)
null
means default values should be used.setPlaceholder(CharSequence)
void setShowPlaceholderWhenFocused(boolean show)
'placeholder text'
is visible when editor is focused.show
- flag indicating whether placeholder is visible when editor is focused.setPlaceholder(CharSequence)
boolean isStickySelection()
setStickySelection(boolean)
call with 'true'
argument.true
if 'sticky selection' mode is active at the current editor; false
otherwisevoid setStickySelection(boolean enable)
sticky selection
mode.enable
- flag that identifies if 'sticky selection'
mode should be enabledint getPrefixTextWidthInPixels()
prefix
used with the current editor if any;
zero otherwisevoid setPrefixTextAndAttributes(java.lang.String prefixText, TextAttributes attributes)
prefixText
- target prefix textattributes
- text attributes to use during given prefix paintingboolean isPurePaintingMode()
setPurePaintingMode(boolean)
void setPurePaintingMode(boolean enabled)
The 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.
enabled
- 'pure painting mode' status to usevoid registerLineExtensionPainter(java.util.function.IntFunction<java.util.Collection<LineExtensionInfo>> lineExtensionPainter)
EditorLinePainter
extensions).void registerScrollBarRepaintCallback(ButtonlessScrollBarUI.ScrollbarRepaintCallback callback)
Animator
to draw itself.callback
- callback which will be called from the JComponent.paint(Graphics)
method of
the editor vertical scrollbar.int getExpectedCaretOffset()
EditorMouseListener.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.void setContextMenuGroupId(java.lang.String groupId)
null
value disabling context menu). This method might have no effect if default editor's popup handler was
overridden using installPopupHandler(EditorPopupHandler)
.getContextMenuGroupId()
java.lang.String getContextMenuGroupId()
null
value meaning no context menu). Returned value might be meaningless if default editor's popup handler
was overridden using installPopupHandler(EditorPopupHandler)
.setContextMenuGroupId(String)
void installPopupHandler(EditorPopupHandler popupHandler)
Default handler shows a context menu corresponding to a certain action group
registered in ActionManager
. Group's id can be changed using 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.
void uninstallPopupHandler(EditorPopupHandler popupHandler)
EditorPopupHandler
.installPopupHandler(EditorPopupHandler)
void setCustomCursor(java.lang.Object requestor, java.awt.Cursor cursor)
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). '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).