ModCommand (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiJavaCodeReferenceElement ref = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiJavaCodeReferenceElement.class); if (ref == null) return ModCommand.nop(); List<ModCommandAction> actions = StreamEx.of(originalClasses).map(SmartPsiElementPointer::getElement) .nonNull().sorted(new PsiProximityComparator(ref.getElement())) .<ModCommandAction>map(cls -> new BindClassAction(ref, cls)) .toList(); return new ModChooseAction(QuickFixBundle.message("add.qualifier.original.class.chooser.title"), actions); }