protected void revertState() {
    if (myOldName == null) return;
    CommandProcessor.getInstance().executeCommand(myProject, () -> {
      Editor topLevelEditor = InjectedLanguageEditorUtil.getTopLevelEditor(myEditor);
      ApplicationManager.getApplication().runWriteAction(() -> {
        TemplateState state = TemplateManagerImpl.getTemplateState(topLevelEditor);
        if (state != null) {
          int segmentsCount = state.getSegmentsCount();
          Document document = topLevelEditor.getDocument();
          for (int i = 0; i < segmentsCount; i++) {
            TextRange segmentRange = state.getSegmentRange(i);
            document.replaceString(segmentRange.getStartOffset(), segmentRange.getEndOffset(), myOldName);
          }
        }
      });
      if (!myProject.isDisposed() && myProject.isOpen()) {
        PsiDocumentManager.getInstance(myProject).commitDocument(topLevelEditor.getDocument());
      }
    }, getCommandName(), null);
  }
protected void revertState()