Tab order in editor [MPS 3.0)]
Is it possible to change the tab order in which the user goes through an editor? I am using mathematical formulas and would like the order to start with the lowerbound, then the upperbound and then the body.
Please sign in to leave a comment.
You can add action maps to the editor cells and change the NEXT (tab) and PREV (shift+tab) actions. To select a specific property you can use
node.select[in: editorContext, cell: {name}];The only problem I have left is how I can specify which editor element gets the focus both on creation, and also whenever the user tabs into the concept.
Changing the target, when the user tabs into the concept is a bit more difficult. Action events are passed up the editor cells tree to the first cell that has a handler for it. If you don't have a root concept where you can handle the events, the remaining option is to override the keymap of MPS and handle the TAB keyboard event directly:
action FocusNext { action context parameters ( always visible = false ) EditorComponent editorComponent key: EDITOR_COMPONENT required isApplicable(event)->boolean { if (!(this.editorComponent.isFocusOwner()) || this.editorComponent.getNodeSubstituteChooser().isVisible()) { return false; } EditorCellLabelSelection selection = this.editorComponent.getSelectionManager().getSelection() as EditorCellLabelSelection; if (selection == null) { return false; } EditorCell currentCell = selection.getEditorCell(); EditorCell nextCell = CellTraversalUtil.getNextLeaf(currentCell, CellConditions.SELECTABLE); node<> currentNode = currentCell.?getSNode(); node<> nextNode = nextCell.?getSNode(); if (!(currentNode.isInstanceOf(MyConcept)) && nextNode.isInstanceOf(MyConcept)) { return true; } return false; } execute(event)->void { EditorCellLabelSelection selection = this.editorComponent.getSelectionManager().getSelection() as EditorCellLabelSelection; if (selection == null) { return; } EditorCell currentCell = selection.getEditorCell(); EditorCell nextCell = CellTraversalUtil.getNextLeaf(currentCell, CellConditions.SELECTABLE); node<MyConcept> nextNode = nextCell.getSNode() : MyConcept; nextNode.select[in: this.editorComponent.getEditorContext(), cell: {name}]; } }I am interested in trying some Java extensions in MPS, but I want to extend Java only - extending Base Language is of no interest to me, and I explicitly must not have any of its extensions. This is, amongst other reasons, so that existing Java codebases can be used directly with any extensions of mine, without any conversion.