IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { int offset = editor.getCaretModel().getOffset(); PsiMethod method = PsiTreeUtil.getParentOfType(file.findElementAt(offset), PsiMethod.class); if (method == null) { return IntentionPreviewInfo.EMPTY; } PsiMethod copy = ((PsiMethod)method.copy()); PsiParameterList list = copy.getParameterList(); list.add(GroovyPsiElementFactory.getInstance(project).createParameter(myName, PsiType.getJavaLangObject(PsiManager.getInstance(project), file.getResolveScope()))); return new IntentionPreviewInfo.CustomDiff(GroovyFileType.GROOVY_FILE_TYPE, method.getText(), copy.getText()); }