@Override
  public @NotNull IntentionPreviewInfo generatePreview(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
    PsiElement element = getElement(editor, file);
    final PsiField field = getField(element);
    if (field == null) return IntentionPreviewInfo.EMPTY;
    RefactoringActionHandler handler = JavaRefactoringActionHandlerFactory.getInstance().createEncapsulateFieldsHandler();
    if (handler instanceof PreviewableRefactoringActionHandler previewableRefactoringActionHandler) {
      return previewableRefactoringActionHandler.generatePreview(project, field);
    }
    return IntentionPreviewInfo.EMPTY;
  }
@Override
  public @NotNull IntentionPreviewInfo generatePreview(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file)