@Override
  public @NotNull IntentionPreviewInfo generatePreview(@NotNull Project project, @NotNull PsiElement element) {
    if (element instanceof PsiClass aClass) {
      myProject = project;
      myManager = PsiManager.getInstance(myProject);
      myAnonOrLocalClass = aClass;
      myNewClassName = AnonymousToInnerDialog.suggestNewClassNames(aClass)[0];
      PsiElement targetContainer = findTargetContainer(myAnonOrLocalClass);
      if (targetContainer instanceof PsiClass) {
        myTargetClass = (PsiClass)targetContainer;
      }
      else {
        return IntentionPreviewInfo.EMPTY;
      }
      myMakeStatic = !needsThis() && !myTargetClass.isInterface();
      Map<PsiVariable,VariableInfo> variableInfoMap = new LinkedHashMap<>();
      collectUsedVariables(variableInfoMap, myAnonOrLocalClass);
      myVariableInfos = variableInfoMap.values().toArray(new VariableInfo[0]);
      VariableData [] variableData = new VariableData[myVariableInfos.length];
      AnonymousToInnerDialog.fillVariableData(myProject, myVariableInfos, variableData);
      AnonymousToInnerDialog.getVariableInfos(myProject, variableData, variableInfoMap);
      doRefactoring();
      return IntentionPreviewInfo.DIFF;
    }
    return IntentionPreviewInfo.EMPTY;
  }
@Override
  public @NotNull IntentionPreviewInfo generatePreview(@NotNull Project project, @NotNull PsiElement element)