ModCommand (@NotNull ActionContext context, @NotNull PsiField field) { final PsiClass myClass = field.getContainingClass(); if (myClass == null) return ModCommand.nop(); if (myClass.getConstructors().length == 0) { return ModCommand.psiUpdate(context, updater -> { PsiClass writableClass = updater.getWritable(myClass); PsiField writableField = updater.getWritable(field); PsiMethod ctor = AddDefaultConstructorFix.addDefaultConstructor(writableClass); addFieldInitialization(List.of(ctor), writableField, updater); }); } List<PsiMethod> ctors = CreateConstructorParameterFromFieldFix.filterConstructorsIfFieldAlreadyAssigned(myClass.getConstructors(), field); List<PsiMethodMember> allMembers = ContainerUtil.map(ctors, PsiMethodMember::new); if (ctors.size() == 1) { return getFinalCommand(field, allMembers); } return new ModChooseMember(QuickFixBundle.message("initialize.final.field.in.constructor.choose.dialog.title"), allMembers, allMembers, ModChooseMember.SelectionMode.MULTIPLE, chosenMembers -> getFinalCommand(field, chosenMembers)); }