示例#1
0
 private EditorCell findTarget(SelectionManager selectionManager) {
   Selection selection = selectionManager.getSelection();
   if (selection == null) {
     return null;
   }
   EditorCell cell = selection.getSelectedCells().get(0);
   while (cell.getParent() != null) {
     cell = (EditorCell) cell.getParent();
   }
   if (cell instanceof EditorCell_Collection) {
     return cell.findChild(
         myHome ? CellFinders.FIRST_SELECTABLE_LEAF : CellFinders.LAST_SELECTABLE_LEAF);
   }
   return cell;
 }
示例#2
0
 public boolean canExecute(jetbrains.mps.openapi.editor.EditorContext context) {
   EditorCell selectedCell = getDeepestSelectedCell(context);
   return selectedCell != null
       && selectedCell.getParent() != null
       && findTarget(selectedCell, selectedCell.getCaretX()) != null;
 }