@Override
  public boolean isSafeDelete() {
    if (getElement() == null) return false;
    final PsiClass classToRemove = getReferencedElement();
    if (classToRemove.getExtendsListTypes().length > 0) {
      final PsiReferenceList listToAddExtends = classToRemove.isInterface() == myExtendingClass.isInterface() ?
                                                myExtendingClass.getExtendsList() :
                                                myExtendingClass.getImplementsList();
      if (listToAddExtends == null) return false;
    }

    if (classToRemove.getImplementsListTypes().length > 0) {
      if (myExtendingClass.getImplementsList() == null) return false;
    }

    PsiResolveHelper resolveHelper = PsiResolveHelper.getInstance(getProject());
    return StreamEx.of(classToRemove.getInterfaces()).prepend(classToRemove.getSuperClass()).nonNull()
      .allMatch(grandParent -> resolveHelper.isAccessible(grandParent, myExtendingClass, null));
  }
@Override
  public boolean isSafeDelete()