@Override
  public boolean isAvailable(@NotNull Project project,
                             @NotNull PsiFile file,
                             @NotNull PsiElement startElement,
                             @NotNull PsiElement endElement) {
    if (!myTypeToExtendFrom.isValid()) return false;
    final PsiClass myClass = (PsiClass)startElement;
    PsiClass classToExtendFrom = myClassToExtendFromPointer != null ? myClassToExtendFromPointer.getElement() : null;
    return
      BaseIntentionAction.canModify(myClass)
      && startElement.isPhysical()
      && classToExtendFrom != null
      && classToExtendFrom.isValid()
      && !classToExtendFrom.hasModifierProperty(PsiModifier.FINAL)
      && (classToExtendFrom.isInterface()
          || !myClass.isInterface()
              && myClass.getExtendsList() != null
              && (myClass.getExtendsList().getReferencedTypes().length == 0) == myToAdd);
  }
@Override
  public boolean isAvailable(@NotNull Project project,
                             @NotNull PsiFile file,
                             @NotNull PsiElement startElement,
                             @NotNull PsiElement endElement)