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; }
/** Should be executed inside read action */ public static void callInsertBeforeAction(@NotNull EditorCell cell) { if (cell.isErrorState() && APICellAdapter.validate(cell, true, true)) { return; } if (cell instanceof EditorCell_Label && !(isLinkCollection(cell))) { // Looking for the prev. child collection (to the left from this cell) EditorCell cellWithRole = new ChildrenCollectionFinder(cell, false, false).find(); if (cellWithRole == null) { // Looking for the next child collection in parents cellWithRole = getSiblingCollectionForInsert(cell, false); } if (cellWithRole != null && APICellAdapter.executeAction(cellWithRole, CellActionType.INSERT_BEFORE)) { return; } } APICellAdapter.executeAction(cell, CellActionType.INSERT_BEFORE); }