public void execute(jetbrains.mps.openapi.editor.EditorContext context) { SelectionManager selectionManager = ((EditorComponent) context.getEditorComponent()).getSelectionManager(); EditorCell cell = findTarget(selectionManager); selectionManager.setSelection(cell); if (cell.isPunctuationLayout() && (cell instanceof EditorCell_Label) && ((EditorCell_Label) cell).isCaretPositionAllowed(1)) { ((EditorCell_Label) cell).setCaretPosition(1); } else { cell.home(); } }
private void adjustSelectionToFoldingState(EditorComponent editorComponent) { if (isDescendantCellSelected(editorComponent)) { editorComponent.clearSelectionStack(); jetbrains.mps.nodeEditor.cells.EditorCell editorCellToSelect = getFirstLeaf(CellConditions.SELECTABLE); if (editorCellToSelect != null) { editorComponent.changeSelection(editorCellToSelect); editorCellToSelect.home(); } else { editorComponent.changeSelection(this); home(); } } }