public abstract class EditorActionHandler
extends java.lang.Object
execute(Editor, Caret, DataContext)
.
Two types of handlers are supported: the ones which are executed once, and the ones which are executed for each caret. The latter can be
created using EditorActionHandler(boolean)
constructor.
Modifier | Constructor and Description |
---|---|
protected |
EditorActionHandler() |
protected |
EditorActionHandler(boolean runForEachCaret) |
Modifier and Type | Method and Description |
---|---|
protected void |
doExecute(Editor editor,
Caret caret,
DataContext dataContext)
Executes the action in the context of given caret.
|
void |
execute(Editor editor,
Caret contextCaret,
DataContext dataContext)
Executes the action in the context of given caret.
|
void |
execute(Editor editor,
DataContext dataContext)
Deprecated.
To implement action logic, override
doExecute(Editor, Caret, DataContext) ,
to invoke the handler, call
execute(Editor, Caret, DataContext) . |
boolean |
executeInCommand(Editor editor,
DataContext dataContext) |
DocCommandGroupId |
getCommandGroupId(Editor editor) |
boolean |
isEnabled(Editor editor,
Caret caret,
DataContext dataContext)
If
caret is null , checks whether handler is enabled in general (i.e. |
boolean |
isEnabled(Editor editor,
DataContext dataContext)
Deprecated.
Implementations should override
isEnabledForCaret(Editor, Caret, DataContext)
instead,
client code should invoke
isEnabled(Editor, Caret, DataContext)
instead. |
protected boolean |
isEnabledForCaret(Editor editor,
Caret caret,
DataContext dataContext)
Implementations can override this method to define whether handler is enabled for a specific caret in a given editor.
|
boolean |
runForAllCarets() |
protected EditorActionHandler()
protected EditorActionHandler(boolean runForEachCaret)
@Deprecated public boolean isEnabled(Editor editor, DataContext dataContext)
isEnabledForCaret(Editor, Caret, DataContext)
instead,
client code should invoke
isEnabled(Editor, Caret, DataContext)
instead.protected boolean isEnabledForCaret(Editor editor, Caret caret, DataContext dataContext)
public final boolean isEnabled(Editor editor, Caret caret, DataContext dataContext)
caret
is null
, checks whether handler is enabled in general (i.e. enabled for at least one caret in editor),
if caret
is not null
, checks whether it's enabled for specified caret.@Deprecated public void execute(Editor editor, DataContext dataContext)
doExecute(Editor, Caret, DataContext)
,
to invoke the handler, call
execute(Editor, Caret, DataContext)
.protected void doExecute(Editor editor, Caret caret, DataContext dataContext)
editor
- the editor in which the action is invoked.caret
- the caret for which the action is performed at the moment, or null
if it's a 'one-off' action executed
without current contextdataContext
- the data context for the action.public boolean executeInCommand(Editor editor, DataContext dataContext)
public boolean runForAllCarets()
public final void execute(Editor editor, Caret contextCaret, DataContext dataContext)
null
, and the handler is a 'per-caret' handler,
it's executed for all carets.editor
- the editor in which the action is invoked.dataContext
- the data context for the action.public DocCommandGroupId getCommandGroupId(Editor editor)