@Override
  public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
    PsiElement textElement = getText(editor, file);
    if (textElement == null) return;


    List<PsiElement> texts = new ArrayList<>();
    PsiElement curr = textElement.getPrevSibling();
    while (isText(curr)) {
      texts.add(0, curr);
      curr = curr.getPrevSibling();
    }
    texts.add(textElement);
    curr = textElement.getNextSibling();
    while (isText(curr)) {
      texts.add(curr);
      curr = curr.getNextSibling();
    }

    StringBuilder text = new StringBuilder();
    for (PsiElement element : texts) {
      text.append(StringUtil.unescapeXmlEntities(element.getText()));
    }
    int start = 0;
    while (true) {
      int pos = text.indexOf("]]>", start);
      if (pos < 0) break;
      text.insert(pos + 1, "]]><![CDATA[");
      start = pos + 2;
    }

    int begin = texts.get(0).getTextRange().getStartOffset();
    String replacement = "<![CDATA[" + text + "]]>";
    editor.getDocument().replaceString(begin, texts.get(texts.size() - 1).getTextRange().getEndOffset(), replacement);
    editor.getCaretModel().moveToOffset(begin + replacement.length());
  }
@Override
  public void invoke(@NotNull Project project, Editor editor, PsiFile file)