public boolean processKeyPressed(final EditorContext editorContext, final KeyEvent keyEvent) { EditorComponent nodeEditor = editorContext.getNodeEditorComponent(); nodeEditor.hideMessageToolTip(); if (processKeyMaps(editorContext, keyEvent)) { return true; } jetbrains.mps.openapi.editor.cells.CellActionType actionType = editorContext.getNodeEditorComponent().getActionType(keyEvent, editorContext); EditorCell selectedCell = editorContext.getSelectedCell(); // process action if (selectedCell != null && actionType != null && editorContext .getEditorComponent() .getActionHandler() .executeAction(selectedCell, actionType)) { return true; } // special case - don't allow kbd focus to leave editor area if (keyEvent.getKeyCode() == KeyEvent.VK_UP && keyEvent.isControlDown() && !keyEvent.isAltDown() && !keyEvent.isShiftDown()) { keyEvent.consume(); } return false; }
public boolean processKeyTyped(EditorContext editorContext, final KeyEvent keyEvent) { EditorComponent nodeEditor = editorContext.getNodeEditorComponent(); nodeEditor.hideMessageToolTip(); if (processKeyMaps(editorContext, keyEvent)) { return true; } final EditorCell selectedCell = editorContext.getSelectedCell(); if (selectedCell != null && ((jetbrains.mps.nodeEditor.cells.EditorCell) selectedCell) .processKeyTyped(keyEvent, false)) { keyEvent.consume(); return true; } jetbrains.mps.openapi.editor.cells.CellActionType actionType = editorContext.getNodeEditorComponent().getActionType(keyEvent, editorContext); if (selectedCell != null) { boolean strictMatching = jetbrains.mps.openapi.editor.cells.CellActionType.RIGHT_TRANSFORM.equals(actionType) || jetbrains.mps.openapi.editor.cells.CellActionType.LEFT_TRANSFORM.equals( actionType); if (selectedCell.isErrorState() && strictMatching) { if (APICellAdapter.validate(selectedCell, strictMatching, false)) { return true; } } if (actionType != null) { if (editorContext .getEditorComponent() .getActionHandler() .executeAction(selectedCell, actionType)) { return true; } } } if (selectedCell != null && ((jetbrains.mps.nodeEditor.cells.EditorCell) selectedCell) .processKeyTyped(keyEvent, true)) { keyEvent.consume(); return true; } return false; }