@Override
  public void invoke(@NotNull Project project,
                     @NotNull PsiFile file,
                     @Nullable Editor editor,
                     @NotNull PsiElement startElement,
                     @NotNull PsiElement endElement) {
    final PsiMethod method = (PsiMethod)startElement;
    if (!FileModificationService.getInstance().prepareFileForWrite(method.getContainingFile())) return;

    final PsiClass containingClass = method.getContainingClass();
    LOG.assertTrue(containingClass != null);

    if (containingClass instanceof PsiAnonymousClass) {
      final PsiClassType baseClassType = ((PsiAnonymousClass)containingClass).getBaseClassType();
      final PsiClass baseClass = baseClassType.resolve();
      if (baseClass != null && BaseIntentionAction.canModify(baseClass)) {
        pullUp(method, containingClass, baseClass);
      }
    }
    else {
      AtomicBoolean noClassesFound = new AtomicBoolean(false);
      PsiTargetNavigator<PsiClass> navigator = new PsiTargetNavigator<>(() -> {
        final LinkedHashSet<PsiClass> classesToPullUp = new LinkedHashSet<>();
        collectClassesToPullUp(classesToPullUp, containingClass.getExtendsListTypes());
        collectClassesToPullUp(classesToPullUp, containingClass.getImplementsListTypes());
        noClassesFound.set(classesToPullUp.isEmpty());
        return new ArrayList<>(classesToPullUp);
      });
      PsiElementProcessor<PsiClass> processor = element -> {
        pullUp(method, containingClass, element);
        return false;
      };
      if (editor != null) {
        navigator.navigate(editor, JavaBundle.message("choose.super.class.popup.title"), processor);
      }
      else {
        navigator.performSilently(processor);
      }

      if (noClassesFound.get()) {
        //check visibility
        var supportProvider = LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE);
        var handler = supportProvider.getExtractInterfaceHandler();
        if (handler == null)  {
          throw new IllegalStateException("Handler is null, supportProvider class = " + supportProvider.getClass());
        }
        handler.invoke(project, new PsiElement[]{containingClass}, null);
      }
    }
  }
@Override
  public void invoke(@NotNull Project project,
                     @NotNull PsiFile file,
                     @Nullable Editor editor,
                     @NotNull PsiElement startElement,
                     @NotNull PsiElement endElement)