private static void doInvoke(final PsiClass targetClass, Consumer<? super PsiClass> invokeImpl) {
    if (!FileModificationService.getInstance().prepareFileForWrite(targetClass.getContainingFile())) {
      return;
    }

    IdeDocumentHistory.getInstance(targetClass.getProject()).includeCurrentPlaceAsChangePlace();
    ApplicationManager.getApplication().runWriteAction(() -> invokeImpl.accept(targetClass));
  }
private static void doInvoke(final PsiClass targetClass, Consumer<? super PsiClass> invokeImpl)