IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { final PsiParameter myParameter = (PsiParameter)getStartElement(); PsiMethod psiMethod = PsiTreeUtil.getParentOfType(myParameter, PsiMethod.class); if (psiMethod == null) { return IntentionPreviewInfo.EMPTY; } if (!(PsiTreeUtil.isAncestor(psiMethod.getParameterList(), myParameter, false))) { return IntentionPreviewInfo.EMPTY; } PsiMethod copyMethod = (PsiMethod)psiMethod.copy(); if (copyMethod == null) { return IntentionPreviewInfo.EMPTY; } int index = psiMethod.getParameterList().getParameterIndex(myParameter); PsiParameter copyParameter = copyMethod.getParameterList().getParameter(index); if (copyParameter == null) { return IntentionPreviewInfo.EMPTY; } copyParameter.delete(); String before = getMethodDescription(psiMethod); String after = getMethodDescription(copyMethod); PsiFile containingFile = myParameter.getContainingFile(); if (containingFile == file.getOriginalFile()) { return new IntentionPreviewInfo.CustomDiff(JavaFileType.INSTANCE, before, after); } else { return new IntentionPreviewInfo.CustomDiff(JavaFileType.INSTANCE, containingFile.getName(), before, after); } }