Esempio n. 1
0
 public void execute(jetbrains.mps.openapi.editor.EditorContext context) {
   EditorCell selection = getDeepestSelectedCell(context);
   EditorCell target = findTarget(selection);
   ((EditorComponent) context.getEditorComponent()).changeSelection(target);
   if (target instanceof EditorCell_Label) {
     EditorCell_Label label = (EditorCell_Label) target;
     label.end();
   }
 }
Esempio n. 2
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);
 }
Esempio n. 3
0
 public void execute(jetbrains.mps.openapi.editor.EditorContext context) {
   EditorCell selection = getDeepestSelectedCell(context);
   EditorCell target = findTarget(selection);
   ((EditorComponent) context.getEditorComponent()).changeSelection(target);
   if (target.isPunctuationLayout() && ((EditorCell_Label) target).isCaretPositionAllowed(1)) {
     ((EditorCell_Label) target).setCaretPosition(1);
   } else if (target instanceof EditorCell_Label) {
     EditorCell_Label label = (EditorCell_Label) target;
     label.home();
   }
 }
Esempio n. 4
0
 @Override
 protected boolean suppressDelete(CellActionType type) {
   if (!super.suppressDelete(type)) {
     return false;
   }
   EditorCell_Label label = getEditorCellLabel();
   if (label.getText().length() == 0) {
     return false;
   }
   if (label instanceof EditorCell_Constant || label instanceof EditorCell_Property) {
     return label.isEditable()
         || CellFinderUtil.findLastSelectableLeaf(APICellAdapter.getContainingBigCell(label))
             != label;
   }
   return true;
 }
Esempio n. 5
0
 public void execute(jetbrains.mps.openapi.editor.EditorContext context) {
   SelectionManager selectionManager =
       ((EditorComponent) context.getEditorComponent()).getSelectionManager();
   EditorCell cell = findTarget(selectionManager);
   selectionManager.pushSelection(selectionManager.createSelection(cell));
   if (cell instanceof EditorCell_Label) {
     ((EditorCell_Label) cell).selectWordOrAll();
   }
 }
Esempio n. 6
0
 protected RestorableSelection createRestorableSelection(EditorContext editorContext) {
   EditorCell selectedCell = editorContext.getSelectedCell();
   String cellId = check_j6szs9_a0b0a(selectedCell);
   SNode selectedNode = check_j6szs9_a0c0a(selectedCell);
   if (cellId == null || selectedNode == null) {
     return null;
   }
   CellIdLocator locator = new CellIdLocator(cellId, selectedNode);
   CellSelector selector;
   if (selectedCell instanceof EditorCell_Label) {
     EditorCell_Label label = ((EditorCell_Label) selectedCell);
     selector =
         new LabelCellSelector(
             label.getCaretPosition(), label.getSelectionStart(), label.getSelectionEnd());
   } else {
     selector = new WholeCellSelector();
   }
   return new RestorableSelectionByCell(locator, selector);
 }
Esempio n. 7
0
 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();
   }
 }
Esempio n. 8
0
 public EditorCellLabelSelection(EditorCell_Label editorCell) {
   super(editorCell);
   mySelectionStart = editorCell.getSelectionStart();
   mySelectionEnd = editorCell.getSelectionEnd();
   myNonTrivialSelection = mySelectionStart != mySelectionEnd;
 }