public void execute(final SNode node, final EditorContext editorContext) {
   SNode newAnnotation =
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.lang.test.structure.NodeOperationsContainer", null);
   AttributeOperations.setAttribute(
       node,
       new IAttributeDescriptor.NodeAttribute(
           "jetbrains.mps.lang.test.structure.NodeOperationsContainer"),
       newAnnotation);
   SNode warningCheck =
       SConceptOperations.createNewNode(
           "jetbrains.mps.lang.test.structure.NodeWarningCheckOperation", null);
   ListSequence.fromList(SLinkOperations.getTargets(newAnnotation, "nodeOperations", true))
       .addElement(warningCheck);
   SelectionUtil.selectCell(editorContext, warningCheck, SelectionManager.LAST_EDITABLE_CELL);
 }
Пример #2
0
  public void execute(EditorContext editorContext) {
    EditorCell selectedCell = editorContext.getSelectedCell();
    if (selectedCell == null) {
      return;
    }
    final String cellId = selectedCell.getCellId();
    SNode actualSelectedNode = selectedCell.getSNode();
    boolean isLabel = selectedCell instanceof EditorCell_Label;
    int startPosition = (isLabel ? ((EditorCell_Label) selectedCell).getSelectionStart() : -1);
    int endPosition = (isLabel ? ((EditorCell_Label) selectedCell).getSelectionEnd() : -1);
    SNode nodeToSelect = CommentUtil.commentOut(myNode);
    editorContext.flushEvents();
    if (cellId != null) {
      EditorCell newNodeCell = editorContext.getEditorComponent().findNodeCell(actualSelectedNode);
      if (newNodeCell != null) {
        EditorCell cellToSelect =
            CellFinderUtil.findChildByCondition(
                newNodeCell,
                new Condition<EditorCell>() {
                  public boolean met(EditorCell cell) {
                    return eq_9lx3n0_a0a0a0a1a0a0b0j0h(cell.getCellId(), cellId);
                  }
                },
                true,
                true);
        if (cellToSelect != null) {
          if (isLabel) {
            editorContext
                .getSelectionManager()
                .setSelection(actualSelectedNode, cellId, startPosition, endPosition);
          } else {
            editorContext.getSelectionManager().setSelection(actualSelectedNode, cellId);
          }

          return;
        }
      }
    }
    SelectionUtil.selectCell(editorContext, nodeToSelect, SelectionManager.LAST_EDITABLE_CELL);
  }
Пример #3
0
 public void execute_internal(EditorContext editorContext, SNode node) {
   SNode nodeToSelect = SNodeOperations.getParent(node);
   SNodeOperations.deleteNode(node);
   SelectionUtil.selectCell(editorContext, nodeToSelect, SelectionManager.FIRST_EDITABLE_CELL);
 }