@Override
  public @NotNull IntentionPreviewInfo generatePreview(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
    PsiType type = myReturnTypePointer.getType();
    if (type == null) {
      return IntentionPreviewInfo.EMPTY;
    }
    PsiMethod method = (PsiMethod)getStartElement();
    type = correctType(method, type);
    PsiFile containingFile = method.getContainingFile();
    if (containingFile == file.getOriginalFile()) {
      PsiMethod methodCopy = PsiTreeUtil.findSameElementInCopy(method, file);
      updateMethodType(methodCopy, type);
      if (!PsiTypes.voidType().equals(type)) {
        ReturnStatementAdder adder = new ReturnStatementAdder(JavaPsiFacade.getElementFactory(project), type);
        adder.addReturnForMethod(file, methodCopy);
      }
      return IntentionPreviewInfo.DIFF;
    }
    PsiModifierList modifiers = method.getModifierList();
    String modifiersText = StreamEx.of(PsiModifier.MODIFIERS).filter(modifiers::hasExplicitModifier).map(mod -> mod + " ").joining();
    PsiType oldType = method.getReturnType();
    String oldTypeText = oldType == null ? "" : oldType.getPresentableText() + " ";
    String newTypeText = type.getPresentableText() + " ";
    String parameters = StreamEx.of(method.getParameterList().getParameters())
      .map(param -> param.getType().getPresentableText() + " " + param.getName())
      .collect(Joining.with(", ").maxChars(50).cutAfterDelimiter());
    String name = method.getName();
    String origText = modifiersText + oldTypeText + name + "(" + parameters + ")";
    String newText = modifiersText + newTypeText + name + "(" + parameters + ")";
    return new IntentionPreviewInfo.CustomDiff(JavaFileType.INSTANCE, containingFile.getName(), origText, newText);
  }
@Override
  public @NotNull IntentionPreviewInfo generatePreview(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file)