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