boolean (@NotNull ActionContext context, @NotNull ModChooseMember modChooser, @Nullable Editor editor) { List<? extends @NotNull MemberChooserElement> result; if (ApplicationManager.getApplication().isUnitTestMode()) { result = modChooser.defaultSelection(); } else { ClassMember[] members = ContainerUtil.map2Array(modChooser.elements(), ClassMember.EMPTY_ARRAY, ClassMember::from); SelectionMode mode = modChooser.mode(); boolean allowEmptySelection = mode == SelectionMode.SINGLE_OR_EMPTY || mode == SelectionMode.MULTIPLE_OR_EMPTY; boolean allowMultiSelection = mode == SelectionMode.MULTIPLE || mode == SelectionMode.MULTIPLE_OR_EMPTY; MemberChooser<ClassMember> chooser = new MemberChooser<>(members, allowEmptySelection, allowMultiSelection, context.project()); ClassMember[] selected = IntStreamEx.ofIndices(modChooser.elements(), modChooser.defaultSelection()::contains) .elements(members).toArray(ClassMember.EMPTY_ARRAY); chooser.selectElements(selected); chooser.setTitle(modChooser.title()); chooser.setCopyJavadocVisible(false); if (!chooser.showAndGet()) return false; List<ClassMember> elements = chooser.getSelectedElements(); result = elements == null ? List.of() : IntStreamEx.ofIndices(members, elements::contains).elements(modChooser.elements()).toList(); } ModCommand nextCommand = ProgressManager.getInstance().runProcessWithProgressSynchronously( () -> ReadAction.nonBlocking(() -> modChooser.nextCommand().apply(result)).executeSynchronously(), modChooser.title(), true, context.project()); executeInteractively(context, nextCommand, editor); return true; }