void (@NotNull AnActionEvent e) { final Editor editor = e.getData(CommonDataKeys.EDITOR); if (editor == null) return; final PsiFile psiFile = e.getDataContext().getData(CommonDataKeys.PSI_FILE); if (!(psiFile instanceof GroovyFile)) return; int offset = editor.getCaretModel().getOffset(); final List<GrControlFlowOwner> controlFlowOwners = collectControlFlowOwners(psiFile, offset); if (controlFlowOwners.isEmpty()) return; if (controlFlowOwners.size() == 1) { passInner(controlFlowOwners.get(0)); } else { IntroduceTargetChooser.showChooser(editor, controlFlowOwners, new Pass<>() { @Override public void pass(GrControlFlowOwner grExpression) { passInner(grExpression); } }, flowOwner -> flowOwner.getText() ); } }