public interface EnterHandlerDelegate
Modifier and Type | Interface and Description |
---|---|
static class |
EnterHandlerDelegate.Result |
Modifier and Type | Field and Description |
---|---|
static ExtensionPointName<EnterHandlerDelegate> |
EP_NAME |
Modifier and Type | Method and Description |
---|---|
EnterHandlerDelegate.Result |
postProcessEnter(PsiFile file,
Editor editor,
DataContext dataContext)
Called at the end of Enter handling after line feed insertion and indentation adjustment.
|
EnterHandlerDelegate.Result |
preprocessEnter(PsiFile file,
Editor editor,
Ref<java.lang.Integer> caretOffset,
Ref<java.lang.Integer> caretAdvance,
DataContext dataContext,
EditorActionHandler originalHandler)
Called before the actual Enter processing is done.
|
static final ExtensionPointName<EnterHandlerDelegate> EP_NAME
EnterHandlerDelegate.Result preprocessEnter(PsiFile file, Editor editor, Ref<java.lang.Integer> caretOffset, Ref<java.lang.Integer> caretAdvance, DataContext dataContext, EditorActionHandler originalHandler)
PsiDocumentManager.getInstance(file.getProject()).commitDocument(editor.getDocument);
file
- The PSI file associated with the document.editor
- The editor.caretOffset
- Indicates a place where line break is to be inserted (it's a caret position initially). Method implementation
can change this value to adjust target line break position.caretAdvance
- A reference to the number of columns by which the caret must be moved forward.dataContext
- The data context passed to the enter handler.originalHandler
- The original handler.EnterHandlerDelegate.Result
values.
EnterHandlerDelegate.Result postProcessEnter(PsiFile file, Editor editor, DataContext dataContext)
Important Note: A document associated with the editor has modifications which are not reflected yet in the PSI file. If any
operations with PSI are needed including a search for PSI elements, the document must be committed first to update the PSI.
For example:
PsiDocumentManager.getInstance(file.getProject()).commitDocument(editor.getDocument);
file
- The PSI file associated with the document.editor
- The editor.dataContext
- The data context passed to the Enter handler.EnterHandlerDelegate.Result
values.
DataContext
,
PsiDocumentManager