@Override
  public @NotNull ModCommand perform(@NotNull ActionContext context) {
    PsiElement element = context.findLeaf();
    PsiMember constructorOrClass = getConstructorOrClass(element);
    if (constructorOrClass == null) return ModCommand.nop();

    List<PsiClass> targets = StreamEx.iterate(constructorOrClass, Objects::nonNull, PsiMember::getContainingClass)
      .select(PsiClass.class)
      .filter(cls -> !(cls instanceof PsiImplicitClass))
      .filter(cls -> cls.hasModifierProperty(PsiModifier.STATIC) || cls.getContainingClass() == null)
      .toList();
    SmartPsiElementPointer<PsiMember> constructorOrClassPtr = SmartPointerManager.createPointer(constructorOrClass);
    List<ModCommandAction> options =
      ContainerUtil.map(targets, target -> ModCommand.psiUpdateStep(
        target, PsiFormatUtil.formatClass(target, PsiFormatUtilBase.SHOW_NAME),
        (cls, updater) -> invoke(cls, updater, constructorOrClassPtr),
        cls -> {
          PsiIdentifier identifier = cls.getNameIdentifier();
          return identifier == null ? cls.getTextRange() : identifier.getTextRange();
        }));
    return ModCommand.chooseAction(JavaBundle.message("popup.title.choose.target.class"), options);
  }
@Override
  public @NotNull ModCommand perform(@NotNull ActionContext context)