@Override
  public void replaceAllChildrenToChildrenOf(@NotNull ASTNode anotherParent) {
    TreeUtil.ensureParsed(getFirstChildNode());
    TreeUtil.ensureParsed(anotherParent.getFirstChildNode());
    ASTNode firstChild = anotherParent.getFirstChildNode();
    ChangeUtil.prepareAndRunChangeAction(
      event -> remove((TreeChangeEventImpl)event, (TreeElement)anotherParent.getFirstChildNode(), null),
      (TreeElement)anotherParent);

    if (firstChild != null) {
      ChangeUtil.prepareAndRunChangeAction(destinationTreeChange -> {
        TreeElement first = getFirstChildNode();
        TreeChangeEventImpl event = (TreeChangeEventImpl)destinationTreeChange;
        CompositeElement parent = getTreeParent();
        if (parent != null) {
          // treat all replacements as one big childrenChanged to simplify resulting PSI/document events
          event.addElementaryChange(parent);
        }
        remove(event, first, null);
        add(event, this, (TreeElement)firstChild);
        if(parent != null) {
          repairRemovedElement(this, first);
        }
      }, this);
    }
    else {
      removeAllChildren();
    }
  }
@Override
  public void replaceAllChildrenToChildrenOf(@NotNull ASTNode anotherParent)