Ejemplo n.º 1
0
 public void execute(jetbrains.mps.openapi.editor.EditorContext context) {
   SelectionManager selectionManager =
       ((EditorComponent) context.getEditorComponent()).getSelectionManager();
   SingularSelection selection = (SingularSelection) selectionManager.getSelection();
   if (!expandSelection(selection) && selectionManager.getSelectionStackSize() > 1) {
     selectionManager.popSelection();
     return;
   }
   EditorCell selected = selection.getEditorCell();
   EditorCell nextLeaf = getNextLeaf(selected);
   EditorCell cellToSelect = getCommonSelectableAncestor(selected, nextLeaf);
   Selection newSelection = selectionManager.createSelection(cellToSelect);
   if (newSelection instanceof SingularSelection) {
     ((SingularSelection) newSelection)
         .setSideSelectDirection(
             mySide == CellSide.LEFT ? SideSelectDirection.LEFT : SideSelectDirection.RIGHT);
   }
   selectionManager.pushSelection(newSelection);
 }