PsiMethod (Editor editor, PsiFile file) { final int caret = editor.getCaretModel().getOffset(); final PsiElement elementAt = file.findElementAt(caret); return MethodUtils.getJavaMethodFromHeader(elementAt); }