Ejemplo n.º 1
0
 public void execute(jetbrains.mps.openapi.editor.EditorContext context) {
   EditorComponent editorComponent = ((EditorComponent) context.getEditorComponent());
   EditorCell target = findTarget(editorComponent);
   if (target instanceof EditorCell_Label) {
     EditorCell_Label label = (EditorCell_Label) target;
     label.end();
     editorComponent.resetLastCaretX();
   }
   editorComponent.changeSelection(target);
 }
Ejemplo n.º 2
0
 public void execute(jetbrains.mps.openapi.editor.EditorContext context) {
   EditorCell selectedCell = getDeepestSelectedCell(context);
   int caretX = selectedCell.getCaretX();
   EditorComponent editorComponent = (EditorComponent) context.getEditorComponent();
   if (editorComponent.hasLastCaretX()) {
     caretX = editorComponent.getLastCaretX();
   }
   editorComponent.saveLastCaretX(caretX);
   EditorCell target = findTarget(selectedCell, caretX);
   target.setCaretX(caretX);
   editorComponent.changeSelection(target, false);
 }
Ejemplo n.º 3
0
 private static void navigatePage(
     jetbrains.mps.openapi.editor.EditorContext context, boolean isDown) {
   EditorComponent editor = (EditorComponent) context.getEditorComponent();
   jetbrains.mps.openapi.editor.cells.EditorCell selection = editor.getSelectedCell();
   Rectangle rect = editor.getVisibleRect();
   int height = (int) rect.getHeight();
   height = isDown ? height : -height;
   int caretX = selection.getCaretX();
   int y = selection.getY() + (selection.getHeight() / 2);
   int newY = y + height;
   jetbrains.mps.openapi.editor.cells.EditorCell target = editor.findCellWeak(caretX, newY);
   if (target == null) {
     target =
         isDown
             ? editor.myRootCell.findChild(CellFinders.LAST_SELECTABLE_LEAF)
             : editor.myRootCell.findChild(CellFinders.FIRST_SELECTABLE_LEAF);
     editor.changeSelection(target);
   } else {
     target.setCaretX(caretX);
     editor.changeSelection(target);
   }
 }
Ejemplo n.º 4
0
 public void execute(jetbrains.mps.openapi.editor.EditorContext context) {
   EditorComponent editorComponent = (EditorComponent) context.getEditorComponent();
   EditorCell selection = editorComponent.getSelectedCell();
   editorComponent.changeSelection(selection.getPrevLeaf(CellConditions.EDITABLE));
 }