void (PsiElement element, final Project project, Editor editor, List<GrField> candidates) { final GrMethod constructor = PsiTreeUtil.getParentOfType(element, GrMethod.class); if (candidates.isEmpty()) return; if (ApplicationManager.getApplication().isUnitTestMode()) { for (GrField candidate : candidates) { addParameter(candidate, constructor, project); } return; } JBPopupFactory.getInstance() .createPopupChooserBuilder(candidates) .setRenderer(new DefaultPsiElementCellRenderer()) .setTitle(GroovyIntentionsBundle.message("create.parameter.for.field.intention.name")). setMovable(true). setItemsChosenCallback((selectedValues) -> CommandProcessor.getInstance().executeCommand(project, () -> { for (GrField selectedValue : selectedValues) { LOG.assertTrue(selectedValue.isValid()); addParameter(selectedValue, constructor, project); } }, GroovyIntentionsBundle.message("create.parameter.for.field.intention.name"), null)).createPopup().showInBestPositionFor(editor); }