コード例 #1
0
 public static boolean virtual_onNewLine_3080189811177340422(SNode thisNode) {
   SNode left = SNodeOperations.getPrevSibling(thisNode);
   if (SNodeOperations.isInstanceOf(left, "jetbrains.mps.core.xml.structure.XmlValuePart")) {
     SNode leftContent =
         SNodeOperations.cast(left, "jetbrains.mps.core.xml.structure.XmlValuePart");
     return SNodeOperations.isInstanceOf(
             leftContent, "jetbrains.mps.core.xml.structure.XmlTextValue")
         || (SPropertyOperations.getString(thisNode, "text") == null
                 || SPropertyOperations.getString(thisNode, "text").length() == 0)
             && (SNodeOperations.getNextSibling(thisNode) == null);
   }
   return false;
 }
コード例 #2
0
ファイル: Scope.java プロジェクト: wolfhesse/MPS
  public static SNode parent(SNode n) {
    if (SNodeOperations.isAttribute(n)) {
      if (SNodeOperations.isInstanceOf(n, "jetbrains.mps.lang.core.structure.NodeAttribute")) {
        SNode next = SNodeOperations.getPrevSibling(n);
        while (next != null) {
          if (SNodeOperations.isInstanceOf(
              next, "jetbrains.mps.lang.core.structure.NodeAttribute")) {
            return next;
          }
          next = SNodeOperations.getPrevSibling(next);
        }
        n = SNodeOperations.getParent(n);
        return (n == null ? null : SNodeOperations.getParent(n));
      }
      return SNodeOperations.getParent(n);
    }
    SNode lastAttr =
        ListSequence.fromList(
                SLinkOperations.getTargets(
                    SNodeOperations.cast(n, "jetbrains.mps.lang.core.structure.BaseConcept"),
                    "smodelAttribute",
                    true))
            .where(
                new IWhereFilter<SNode>() {
                  public boolean accept(SNode it) {
                    return SNodeOperations.isInstanceOf(
                        it, "jetbrains.mps.lang.core.structure.NodeAttribute");
                  }
                })
            .last();
    if ((lastAttr != null)) {
      return lastAttr;
    }

    return SNodeOperations.getParent(n);
  }
  private boolean isApplicableToNode(final SNode node, final EditorContext editorContext) {
    SNode declarationStmt;
    SNode initializerStmt;

    if (SNodeOperations.isInstanceOf(
            node,
            MetaAdapterFactory.getConcept(
                0xf3061a5392264cc5L,
                0xa443f952ceaf5816L,
                0xf8cc67c7f0L,
                "jetbrains.mps.baseLanguage.structure.LocalVariableDeclarationStatement"))
        && SNodeOperations.isInstanceOf(
            SNodeOperations.getNextSibling(node),
            MetaAdapterFactory.getConcept(
                0xf3061a5392264cc5L,
                0xa443f952ceaf5816L,
                0xf8cc56b213L,
                "jetbrains.mps.baseLanguage.structure.ExpressionStatement"))) {
      declarationStmt =
          SNodeOperations.cast(
              node,
              MetaAdapterFactory.getConcept(
                  0xf3061a5392264cc5L,
                  0xa443f952ceaf5816L,
                  0xf8cc67c7f0L,
                  "jetbrains.mps.baseLanguage.structure.LocalVariableDeclarationStatement"));
      initializerStmt =
          SNodeOperations.cast(
              SNodeOperations.getNextSibling(node),
              MetaAdapterFactory.getConcept(
                  0xf3061a5392264cc5L,
                  0xa443f952ceaf5816L,
                  0xf8cc56b213L,
                  "jetbrains.mps.baseLanguage.structure.ExpressionStatement"));
    } else {
      if (SNodeOperations.isInstanceOf(
              node,
              MetaAdapterFactory.getConcept(
                  0xf3061a5392264cc5L,
                  0xa443f952ceaf5816L,
                  0xf8cc56b213L,
                  "jetbrains.mps.baseLanguage.structure.ExpressionStatement"))
          && SNodeOperations.isInstanceOf(
              SNodeOperations.getPrevSibling(node),
              MetaAdapterFactory.getConcept(
                  0xf3061a5392264cc5L,
                  0xa443f952ceaf5816L,
                  0xf8cc67c7f0L,
                  "jetbrains.mps.baseLanguage.structure.LocalVariableDeclarationStatement"))) {
        declarationStmt =
            SNodeOperations.cast(
                SNodeOperations.getPrevSibling(node),
                MetaAdapterFactory.getConcept(
                    0xf3061a5392264cc5L,
                    0xa443f952ceaf5816L,
                    0xf8cc67c7f0L,
                    "jetbrains.mps.baseLanguage.structure.LocalVariableDeclarationStatement"));
        initializerStmt =
            SNodeOperations.cast(
                node,
                MetaAdapterFactory.getConcept(
                    0xf3061a5392264cc5L,
                    0xa443f952ceaf5816L,
                    0xf8cc56b213L,
                    "jetbrains.mps.baseLanguage.structure.ExpressionStatement"));
      } else {
        return false;
      }
    }

    if ((SLinkOperations.getTarget(
            SLinkOperations.getTarget(
                declarationStmt,
                MetaAdapterFactory.getContainmentLink(
                    0xf3061a5392264cc5L,
                    0xa443f952ceaf5816L,
                    0xf8cc67c7f0L,
                    0xf8cc67c7f1L,
                    "localVariableDeclaration")),
            MetaAdapterFactory.getContainmentLink(
                0xf3061a5392264cc5L,
                0xa443f952ceaf5816L,
                0xf8c37a7f6eL,
                0xf8c37f506eL,
                "initializer"))
        == null)) {
      if (SNodeOperations.isInstanceOf(
          SLinkOperations.getTarget(
              initializerStmt,
              MetaAdapterFactory.getContainmentLink(
                  0xf3061a5392264cc5L,
                  0xa443f952ceaf5816L,
                  0xf8cc56b213L,
                  0xf8cc56b214L,
                  "expression")),
          MetaAdapterFactory.getConcept(
              0xf3061a5392264cc5L,
              0xa443f952ceaf5816L,
              0xf8c77f1e96L,
              "jetbrains.mps.baseLanguage.structure.AssignmentExpression"))) {
        SNode assignment =
            SNodeOperations.cast(
                SLinkOperations.getTarget(
                    SNodeOperations.cast(
                        initializerStmt,
                        MetaAdapterFactory.getConcept(
                            0xf3061a5392264cc5L,
                            0xa443f952ceaf5816L,
                            0xf8cc56b213L,
                            "jetbrains.mps.baseLanguage.structure.ExpressionStatement")),
                    MetaAdapterFactory.getContainmentLink(
                        0xf3061a5392264cc5L,
                        0xa443f952ceaf5816L,
                        0xf8cc56b213L,
                        0xf8cc56b214L,
                        "expression")),
                MetaAdapterFactory.getConcept(
                    0xf3061a5392264cc5L,
                    0xa443f952ceaf5816L,
                    0xf8c77f1e96L,
                    "jetbrains.mps.baseLanguage.structure.AssignmentExpression"));
        if (SNodeOperations.isInstanceOf(
                SLinkOperations.getTarget(
                    assignment,
                    MetaAdapterFactory.getContainmentLink(
                        0xf3061a5392264cc5L,
                        0xa443f952ceaf5816L,
                        0x11b0d00332cL,
                        0xf8c77f1e97L,
                        "lValue")),
                MetaAdapterFactory.getConcept(
                    0xf3061a5392264cc5L,
                    0xa443f952ceaf5816L,
                    0xf8c77f1e98L,
                    "jetbrains.mps.baseLanguage.structure.VariableReference"))
            && eq_9fbomu_a0a0b0a0f0e(
                SLinkOperations.getTarget(
                    SNodeOperations.cast(
                        SLinkOperations.getTarget(
                            assignment,
                            MetaAdapterFactory.getContainmentLink(
                                0xf3061a5392264cc5L,
                                0xa443f952ceaf5816L,
                                0x11b0d00332cL,
                                0xf8c77f1e97L,
                                "lValue")),
                        MetaAdapterFactory.getConcept(
                            0xf3061a5392264cc5L,
                            0xa443f952ceaf5816L,
                            0xf8c77f1e98L,
                            "jetbrains.mps.baseLanguage.structure.VariableReference")),
                    MetaAdapterFactory.getReferenceLink(
                        0xf3061a5392264cc5L,
                        0xa443f952ceaf5816L,
                        0xf8c77f1e98L,
                        0xf8cc6bf960L,
                        "variableDeclaration")),
                SLinkOperations.getTarget(
                    declarationStmt,
                    MetaAdapterFactory.getContainmentLink(
                        0xf3061a5392264cc5L,
                        0xa443f952ceaf5816L,
                        0xf8cc67c7f0L,
                        0xf8cc67c7f1L,
                        "localVariableDeclaration")))
            && (boolean)
                AssignmentExpression__BehaviorDescriptor
                    .canConvertToLocalVariableDeclaration_idhLFstkU.invoke(assignment)) {
          return true;
        }
      }
    }
    return false;
  }
    @Override
    public void execute(final SNode node, final EditorContext editorContext) {
      SNode declarationStmt;
      SNode initializerStmt;

      if (SNodeOperations.isInstanceOf(
          node,
          MetaAdapterFactory.getConcept(
              0xf3061a5392264cc5L,
              0xa443f952ceaf5816L,
              0xf8cc67c7f0L,
              "jetbrains.mps.baseLanguage.structure.LocalVariableDeclarationStatement"))) {
        declarationStmt =
            SNodeOperations.cast(
                node,
                MetaAdapterFactory.getConcept(
                    0xf3061a5392264cc5L,
                    0xa443f952ceaf5816L,
                    0xf8cc67c7f0L,
                    "jetbrains.mps.baseLanguage.structure.LocalVariableDeclarationStatement"));
        initializerStmt =
            SNodeOperations.cast(
                SNodeOperations.getNextSibling(node),
                MetaAdapterFactory.getConcept(
                    0xf3061a5392264cc5L,
                    0xa443f952ceaf5816L,
                    0xf8cc56b213L,
                    "jetbrains.mps.baseLanguage.structure.ExpressionStatement"));
      } else {
        declarationStmt =
            SNodeOperations.cast(
                SNodeOperations.getPrevSibling(node),
                MetaAdapterFactory.getConcept(
                    0xf3061a5392264cc5L,
                    0xa443f952ceaf5816L,
                    0xf8cc67c7f0L,
                    "jetbrains.mps.baseLanguage.structure.LocalVariableDeclarationStatement"));
        initializerStmt =
            SNodeOperations.cast(
                node,
                MetaAdapterFactory.getConcept(
                    0xf3061a5392264cc5L,
                    0xa443f952ceaf5816L,
                    0xf8cc56b213L,
                    "jetbrains.mps.baseLanguage.structure.ExpressionStatement"));
      }
      SNodeOperations.deleteNode(initializerStmt);
      SLinkOperations.setTarget(
          SLinkOperations.getTarget(
              declarationStmt,
              MetaAdapterFactory.getContainmentLink(
                  0xf3061a5392264cc5L,
                  0xa443f952ceaf5816L,
                  0xf8cc67c7f0L,
                  0xf8cc67c7f1L,
                  "localVariableDeclaration")),
          MetaAdapterFactory.getContainmentLink(
              0xf3061a5392264cc5L,
              0xa443f952ceaf5816L,
              0xf8c37a7f6eL,
              0xf8c37f506eL,
              "initializer"),
          SLinkOperations.getTarget(
              SNodeOperations.cast(
                  SLinkOperations.getTarget(
                      initializerStmt,
                      MetaAdapterFactory.getContainmentLink(
                          0xf3061a5392264cc5L,
                          0xa443f952ceaf5816L,
                          0xf8cc56b213L,
                          0xf8cc56b214L,
                          "expression")),
                  MetaAdapterFactory.getConcept(
                      0xf3061a5392264cc5L,
                      0xa443f952ceaf5816L,
                      0xf8c77f1e96L,
                      "jetbrains.mps.baseLanguage.structure.AssignmentExpression")),
              MetaAdapterFactory.getContainmentLink(
                  0xf3061a5392264cc5L,
                  0xa443f952ceaf5816L,
                  0x11b0d00332cL,
                  0xf8c77f1e99L,
                  "rValue")));
    }
コード例 #5
0
  private static NodeCaretPair smartDelete_id7PYAiugbmRz(
      @NotNull SNode __thisNode__, boolean isBeginning) {
    SNode line =
        SNodeOperations.cast(
            SNodeOperations.getParent(__thisNode__),
            MetaAdapterFactory.getConcept(
                0xf280165065d5424eL,
                0xbb1b463a8781b786L,
                0x757ba20a4c87f96cL,
                "jetbrains.mps.baseLanguage.javadoc.structure.CommentLine"));
    int index = SNodeOperations.getIndexInParent(__thisNode__);
    Iterable<SNode> lines =
        SLinkOperations.getChildren(
            __thisNode__,
            MetaAdapterFactory.getContainmentLink(
                0xf280165065d5424eL,
                0xbb1b463a8781b786L,
                0x5bc4aa08e154b399L,
                0x5bc4aa08e154b39bL,
                "line"));

    SNode nodeToSelect = null;
    int caret = -1;

    if (Sequence.fromIterable(lines).isEmpty()) {
      SNode prev = SNodeOperations.getPrevSibling(__thisNode__);
      if (isNotEmptyString(
          SPropertyOperations.getString(
              SNodeOperations.cast(
                  prev,
                  MetaAdapterFactory.getConcept(
                      0xf280165065d5424eL,
                      0xbb1b463a8781b786L,
                      0x7c7f5b2f31990287L,
                      "jetbrains.mps.baseLanguage.javadoc.structure.TextCommentLinePart")),
              MetaAdapterFactory.getProperty(
                  0xf280165065d5424eL,
                  0xbb1b463a8781b786L,
                  0x7c7f5b2f31990287L,
                  0x7c7f5b2f31990288L,
                  "text")))) {
        caret =
            SPropertyOperations.getString(
                    SNodeOperations.cast(
                        prev,
                        MetaAdapterFactory.getConcept(
                            0xf280165065d5424eL,
                            0xbb1b463a8781b786L,
                            0x7c7f5b2f31990287L,
                            "jetbrains.mps.baseLanguage.javadoc.structure.TextCommentLinePart")),
                    MetaAdapterFactory.getProperty(
                        0xf280165065d5424eL,
                        0xbb1b463a8781b786L,
                        0x7c7f5b2f31990287L,
                        0x7c7f5b2f31990288L,
                        "text"))
                .length();
      }
      SNodeOperations.deleteNode(__thisNode__);
      CommentLine_BehaviorDescriptor.tryMergeToRight_idooaTF_3fF3.invoke(line, index - 1);
      return new NodeCaretPair(prev, caret);
    } else {
      //  Merging first line
      for (SNode part :
          ListSequence.fromList(
              SLinkOperations.getChildren(
                  ListSequence.fromList(
                          SLinkOperations.getChildren(
                              __thisNode__,
                              MetaAdapterFactory.getContainmentLink(
                                  0xf280165065d5424eL,
                                  0xbb1b463a8781b786L,
                                  0x5bc4aa08e154b399L,
                                  0x5bc4aa08e154b39bL,
                                  "line")))
                      .first(),
                  MetaAdapterFactory.getContainmentLink(
                      0xf280165065d5424eL,
                      0xbb1b463a8781b786L,
                      0x757ba20a4c87f96cL,
                      0x7c7f5b2f3199028dL,
                      "part")))) {
        SNodeOperations.insertPrevSiblingChild(__thisNode__, part);
      }
      SNodeOperations.deleteNode(
          ListSequence.fromList(
                  SLinkOperations.getChildren(
                      __thisNode__,
                      MetaAdapterFactory.getContainmentLink(
                          0xf280165065d5424eL,
                          0xbb1b463a8781b786L,
                          0x5bc4aa08e154b399L,
                          0x5bc4aa08e154b39bL,
                          "line")))
              .first());
      if (isBeginning) {
        nodeToSelect =
            ListSequence.fromList(
                    SLinkOperations.getChildren(
                        line,
                        MetaAdapterFactory.getContainmentLink(
                            0xf280165065d5424eL,
                            0xbb1b463a8781b786L,
                            0x757ba20a4c87f96cL,
                            0x7c7f5b2f3199028dL,
                            "part")))
                .getElement(index - 1);
        caret =
            SPropertyOperations.getString(
                    SNodeOperations.cast(
                        ListSequence.fromList(
                                SLinkOperations.getChildren(
                                    line,
                                    MetaAdapterFactory.getContainmentLink(
                                        0xf280165065d5424eL,
                                        0xbb1b463a8781b786L,
                                        0x757ba20a4c87f96cL,
                                        0x7c7f5b2f3199028dL,
                                        "part")))
                            .getElement(index - 1),
                        MetaAdapterFactory.getConcept(
                            0xf280165065d5424eL,
                            0xbb1b463a8781b786L,
                            0x7c7f5b2f31990287L,
                            "jetbrains.mps.baseLanguage.javadoc.structure.TextCommentLinePart")),
                    MetaAdapterFactory.getProperty(
                        0xf280165065d5424eL,
                        0xbb1b463a8781b786L,
                        0x7c7f5b2f31990287L,
                        0x7c7f5b2f31990288L,
                        "text"))
                .length();
      }
      CommentLine_BehaviorDescriptor.tryMergeToRight_idooaTF_3fF3.invoke(line, index - 1);

      //  Merging other lines
      SNode lastElementLine =
          ListSequence.fromList(
                  SLinkOperations.getChildren(
                      __thisNode__,
                      MetaAdapterFactory.getContainmentLink(
                          0xf280165065d5424eL,
                          0xbb1b463a8781b786L,
                          0x5bc4aa08e154b399L,
                          0x5bc4aa08e154b39bL,
                          "line")))
              .last();
      for (SNode elementLine :
          ListSequence.fromList(
                  SLinkOperations.getChildren(
                      __thisNode__,
                      MetaAdapterFactory.getContainmentLink(
                          0xf280165065d5424eL,
                          0xbb1b463a8781b786L,
                          0x5bc4aa08e154b399L,
                          0x5bc4aa08e154b39bL,
                          "line")))
              .reversedList()) {
        SNodeOperations.insertNextSiblingChild(line, elementLine);
      }

      if ((lastElementLine == null)) {
        index = SNodeOperations.getIndexInParent(__thisNode__);
        SNodeOperations.deleteNode(__thisNode__);
        if (!(isBeginning)) {
          nodeToSelect =
              ListSequence.fromList(
                      SLinkOperations.getChildren(
                          line,
                          MetaAdapterFactory.getContainmentLink(
                              0xf280165065d5424eL,
                              0xbb1b463a8781b786L,
                              0x757ba20a4c87f96cL,
                              0x7c7f5b2f3199028dL,
                              "part")))
                  .getElement(index - 1);
          caret =
              SPropertyOperations.getString(
                      SNodeOperations.cast(
                          ListSequence.fromList(
                                  SLinkOperations.getChildren(
                                      line,
                                      MetaAdapterFactory.getContainmentLink(
                                          0xf280165065d5424eL,
                                          0xbb1b463a8781b786L,
                                          0x757ba20a4c87f96cL,
                                          0x7c7f5b2f3199028dL,
                                          "part")))
                              .getElement(index - 1),
                          MetaAdapterFactory.getConcept(
                              0xf280165065d5424eL,
                              0xbb1b463a8781b786L,
                              0x7c7f5b2f31990287L,
                              "jetbrains.mps.baseLanguage.javadoc.structure.TextCommentLinePart")),
                      MetaAdapterFactory.getProperty(
                          0xf280165065d5424eL,
                          0xbb1b463a8781b786L,
                          0x7c7f5b2f31990287L,
                          0x7c7f5b2f31990288L,
                          "text"))
                  .length();
        }
        CommentLine_BehaviorDescriptor.tryMergeToRight_idooaTF_3fF3.invoke(line, index - 1);
      } else {
        //  Merging last line parts
        index =
            ListSequence.fromList(
                        SLinkOperations.getChildren(
                            lastElementLine,
                            MetaAdapterFactory.getContainmentLink(
                                0xf280165065d5424eL,
                                0xbb1b463a8781b786L,
                                0x757ba20a4c87f96cL,
                                0x7c7f5b2f3199028dL,
                                "part")))
                    .count()
                - 1;
        for (SNode linePart :
            ListSequence.fromList(SNodeOperations.getNextSiblings(__thisNode__, false))) {
          ListSequence.fromList(
                  SLinkOperations.getChildren(
                      lastElementLine,
                      MetaAdapterFactory.getContainmentLink(
                          0xf280165065d5424eL,
                          0xbb1b463a8781b786L,
                          0x757ba20a4c87f96cL,
                          0x7c7f5b2f3199028dL,
                          "part")))
              .addElement(
                  SNodeOperations.cast(
                      linePart,
                      MetaAdapterFactory.getConcept(
                          0xf280165065d5424eL,
                          0xbb1b463a8781b786L,
                          0x7c7f5b2f31990286L,
                          "jetbrains.mps.baseLanguage.javadoc.structure.CommentLinePart")));
        }
        SNodeOperations.deleteNode(__thisNode__);
        if (!(isBeginning)) {
          nodeToSelect =
              ListSequence.fromList(
                      SLinkOperations.getChildren(
                          lastElementLine,
                          MetaAdapterFactory.getContainmentLink(
                              0xf280165065d5424eL,
                              0xbb1b463a8781b786L,
                              0x757ba20a4c87f96cL,
                              0x7c7f5b2f3199028dL,
                              "part")))
                  .getElement(index);
          caret =
              SPropertyOperations.getString(
                      SNodeOperations.cast(
                          ListSequence.fromList(
                                  SLinkOperations.getChildren(
                                      lastElementLine,
                                      MetaAdapterFactory.getContainmentLink(
                                          0xf280165065d5424eL,
                                          0xbb1b463a8781b786L,
                                          0x757ba20a4c87f96cL,
                                          0x7c7f5b2f3199028dL,
                                          "part")))
                              .getElement(index),
                          MetaAdapterFactory.getConcept(
                              0xf280165065d5424eL,
                              0xbb1b463a8781b786L,
                              0x7c7f5b2f31990287L,
                              "jetbrains.mps.baseLanguage.javadoc.structure.TextCommentLinePart")),
                      MetaAdapterFactory.getProperty(
                          0xf280165065d5424eL,
                          0xbb1b463a8781b786L,
                          0x7c7f5b2f31990287L,
                          0x7c7f5b2f31990288L,
                          "text"))
                  .length();
        }
        CommentLine_BehaviorDescriptor.tryMergeToRight_idooaTF_3fF3.invoke(lastElementLine, index);
      }
    }
    return new NodeCaretPair(nodeToSelect, caret);
  }
コード例 #6
0
 public void execute_internal(EditorContext editorContext, SNode node) {
   SNode selected = editorContext.getSelectedNode();
   if (SNodeOperations.isInstanceOf(
           selected,
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x57d533a7af15ed3bL,
               "jetbrains.mps.baseLanguage.structure.CommentPart"))
       && SNodeOperations.isInstanceOf(
           SNodeOperations.getParent(selected),
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x57d533a7af15ed3aL,
               "jetbrains.mps.baseLanguage.structure.SingleLineComment"))
       && !(ListSequence.fromList(
               SLinkOperations.getChildren(
                   node,
                   MetaAdapterFactory.getContainmentLink(
                       0xf3061a5392264cc5L,
                       0xa443f952ceaf5816L,
                       0x57d533a7af15ed3aL,
                       0x57d533a7af16ff73L,
                       "commentPart")))
           .contains(
               SNodeOperations.cast(
                   selected,
                   MetaAdapterFactory.getConcept(
                       0xf3061a5392264cc5L,
                       0xa443f952ceaf5816L,
                       0x57d533a7af15ed3bL,
                       "jetbrains.mps.baseLanguage.structure.CommentPart"))))) {
     SNode prevLine =
         SNodeOperations.cast(
             SNodeOperations.getParent(selected),
             MetaAdapterFactory.getConcept(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0x57d533a7af15ed3aL,
                 "jetbrains.mps.baseLanguage.structure.SingleLineComment"));
     ListSequence.fromList(
             SLinkOperations.getChildren(
                 prevLine,
                 MetaAdapterFactory.getContainmentLink(
                     0xf3061a5392264cc5L,
                     0xa443f952ceaf5816L,
                     0x57d533a7af15ed3aL,
                     0x57d533a7af16ff73L,
                     "commentPart")))
         .addSequence(
             ListSequence.fromList(
                 SLinkOperations.getChildren(
                     node,
                     MetaAdapterFactory.getContainmentLink(
                         0xf3061a5392264cc5L,
                         0xa443f952ceaf5816L,
                         0x57d533a7af15ed3aL,
                         0x57d533a7af16ff73L,
                         "commentPart"))));
     SNodeOperations.deleteNode(node);
     return;
   }
   if (SNodeOperations.isInstanceOf(
       ListSequence.fromList(
               SLinkOperations.getChildren(
                   node,
                   MetaAdapterFactory.getContainmentLink(
                       0xf3061a5392264cc5L,
                       0xa443f952ceaf5816L,
                       0x57d533a7af15ed3aL,
                       0x57d533a7af16ff73L,
                       "commentPart")))
           .first(),
       MetaAdapterFactory.getConcept(
           0xf3061a5392264cc5L,
           0xa443f952ceaf5816L,
           0x57d533a7af16ff67L,
           "jetbrains.mps.baseLanguage.structure.StatementCommentPart"))) {
     SNodeOperations.replaceWithAnother(
         node,
         SLinkOperations.getTarget(
             SNodeOperations.cast(
                 ListSequence.fromList(
                         SLinkOperations.getChildren(
                             node,
                             MetaAdapterFactory.getContainmentLink(
                                 0xf3061a5392264cc5L,
                                 0xa443f952ceaf5816L,
                                 0x57d533a7af15ed3aL,
                                 0x57d533a7af16ff73L,
                                 "commentPart")))
                     .first(),
                 MetaAdapterFactory.getConcept(
                     0xf3061a5392264cc5L,
                     0xa443f952ceaf5816L,
                     0x57d533a7af16ff67L,
                     "jetbrains.mps.baseLanguage.structure.StatementCommentPart")),
             MetaAdapterFactory.getContainmentLink(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0x57d533a7af16ff67L,
                 0x57d533a7af16ff68L,
                 "commentedStatement")));
     return;
   }
   if (SNodeOperations.isInstanceOf(
           selected,
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x57d533a7af15ed3aL,
               "jetbrains.mps.baseLanguage.structure.SingleLineComment"))
       && SNodeOperations.isInstanceOf(
           SNodeOperations.getPrevSibling(selected),
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x57d533a7af15ed3aL,
               "jetbrains.mps.baseLanguage.structure.SingleLineComment"))) {
     // if we got 'delete' for whole comment (not CommentPart), and this map is attached to
     // double slash
     // constant, it's likely we got 'Del' or 'Backspace' (no way to tell one from another)
     // pressed over
     // double slash constant. Try to join comment lines then.
     SNode prevLine =
         SNodeOperations.cast(
             SNodeOperations.getPrevSibling(selected),
             MetaAdapterFactory.getConcept(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0x57d533a7af15ed3aL,
                 "jetbrains.mps.baseLanguage.structure.SingleLineComment"));
     ListSequence.fromList(
             SLinkOperations.getChildren(
                 prevLine,
                 MetaAdapterFactory.getContainmentLink(
                     0xf3061a5392264cc5L,
                     0xa443f952ceaf5816L,
                     0x57d533a7af15ed3aL,
                     0x57d533a7af16ff73L,
                     "commentPart")))
         .addSequence(
             ListSequence.fromList(
                 SLinkOperations.getChildren(
                     node,
                     MetaAdapterFactory.getContainmentLink(
                         0xf3061a5392264cc5L,
                         0xa443f952ceaf5816L,
                         0x57d533a7af15ed3aL,
                         0x57d533a7af16ff73L,
                         "commentPart"))));
     SNodeOperations.deleteNode(node);
   }
 }