Example #1
0
 public int getIconCoordinate(EditorMessageIconRenderer renderer) {
   jetbrains.mps.openapi.editor.cells.EditorCell anchorCell = getAnchorCell(renderer);
   if (anchorCell == null || APICellAdapter.isUnderFolded(anchorCell)) {
     // no anchorCell
     return -1;
   }
   if (renderer.getIcon() == null) {
     LOG.error("null icon was returned by renderer: " + renderer);
     return -1;
   }
   return anchorCell.getY() + anchorCell.getHeight() / 2 - renderer.getIcon().getIconHeight() / 2;
 }
Example #2
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);
   }
 }