use of com.intellij.openapi.editor.actionSystem.EditorActionHandler in project idea-handlebars by dmarcotte.
the class HbActionHandlerTest method doEnterTest.
/**
* Call this method to test behavior when Enter is typed.
* See class documentation for more info: {@link HbActionHandlerTest}
*/
protected void doEnterTest(@NotNull String before, @NotNull String expected) {
final EditorActionHandler enterActionHandler = EditorActionManager.getInstance().getActionHandler(IdeActions.ACTION_EDITOR_ENTER);
doExecuteActionTest(before, expected, new Runnable() {
@Override
public void run() {
enterActionHandler.execute(myFixture.getEditor(), ((EditorEx) myFixture.getEditor()).getDataContext());
}
});
}
use of com.intellij.openapi.editor.actionSystem.EditorActionHandler in project intellij-community by JetBrains.
the class CustomFileTypeEditorTest method performEndBlockAction.
private static void performEndBlockAction() {
EditorActionHandler actionHandler = new CodeBlockEndAction().getHandler();
actionHandler.execute(getEditor(), getCurrentEditorDataContext());
}
use of com.intellij.openapi.editor.actionSystem.EditorActionHandler in project intellij-community by JetBrains.
the class LeaveCodeBlockEnterProcessor method doEnter.
@Override
public boolean doEnter(Editor editor, PsiElement psiElement, boolean isModified) {
PsiElement parent = psiElement.getParent();
if (!(parent instanceof PsiCodeBlock)) {
return false;
}
final ASTNode node = psiElement.getNode();
if (node != null && CONTROL_FLOW_ELEMENT_TYPES.contains(node.getElementType())) {
return false;
}
boolean leaveCodeBlock = isControlFlowBreak(psiElement);
if (!leaveCodeBlock) {
return false;
}
final int offset = parent.getTextRange().getEndOffset();
// Check if there is empty line after the code block. Just move caret there in the case of the positive answer.
final CharSequence text = editor.getDocument().getCharsSequence();
if (offset < text.length() - 1) {
final int i = CharArrayUtil.shiftForward(text, offset + 1, " \t");
if (i < text.length() && text.charAt(i) == '\n') {
editor.getCaretModel().moveToOffset(offset + 1);
EditorActionManager actionManager = EditorActionManager.getInstance();
EditorActionHandler actionHandler = actionManager.getActionHandler(IdeActions.ACTION_EDITOR_MOVE_LINE_END);
final DataContext dataContext = DataManager.getInstance().getDataContext(editor.getComponent());
if (dataContext != null) {
actionHandler.execute(editor, dataContext);
return true;
}
}
}
editor.getCaretModel().moveToOffset(offset);
return false;
}
use of com.intellij.openapi.editor.actionSystem.EditorActionHandler in project intellij-community by JetBrains.
the class GenerateJavadocTest method performAction.
private void performAction() {
EditorActionManager actionManager = EditorActionManager.getInstance();
EditorActionHandler actionHandler = actionManager.getActionHandler(IdeActions.ACTION_EDITOR_ENTER);
actionHandler.execute(myEditor, DataManager.getInstance().getDataContext());
}
use of com.intellij.openapi.editor.actionSystem.EditorActionHandler in project intellij-community by JetBrains.
the class TextComponentSelectionModel method selectWordAtCaret.
@Override
public void selectWordAtCaret(final boolean honorCamelWordsSettings) {
removeSelection();
EditorActionHandler handler = EditorActionManager.getInstance().getActionHandler(IdeActions.ACTION_EDITOR_SELECT_WORD_AT_CARET);
handler.execute(myEditor, null, DataManager.getInstance().getDataContext(myEditor.getComponent()));
}
Aggregations