@Override
  public @Nullable FileModifier getFileModifierForPreview(@NotNull PsiFile target) {
    // Check field safety in subclass
    if (LocalQuickFix.super.getFileModifierForPreview(target) != this) return null;
    PsiElement startElement = getStartElement();
    PsiElement endElement = getEndElement();
    if (startElement == null && myStartElement != null || 
        endElement == null && myEndElement != null) return null;
    if (startElement != null && startElement.getContainingFile() != target.getOriginalFile()) return null;
    startElement = PsiTreeUtil.findSameElementInCopy(startElement, target);
    endElement = PsiTreeUtil.findSameElementInCopy(endElement, target);
    LocalQuickFixOnPsiElement clone;
    try {
      clone = (LocalQuickFixOnPsiElement)super.clone();
    }
    catch (CloneNotSupportedException e) {
      throw new InternalError(e); // should not happen as we implement Cloneable
    }
    if (startElement != null) {
      ReflectionUtil.setField(LocalQuickFixOnPsiElement.class, clone, SmartPsiElementPointer.class, "myStartElement",
                              SmartPointerManager.createPointer(startElement));
    }
    if (endElement != null) {
      ReflectionUtil.setField(LocalQuickFixOnPsiElement.class, clone, SmartPsiElementPointer.class, "myEndElement",
                              SmartPointerManager.createPointer(endElement));
    }
    return clone;
  }
@Override
  public @Nullable FileModifier getFileModifierForPreview(@NotNull PsiFile target)