void (@NotNull Project project, @NotNull PsiElement nameElement, @NotNull ModPsiUpdater updater) { final PsiReferenceExpression methodExpression = (PsiReferenceExpression)nameElement.getParent(); if (methodExpression == null) return; final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)methodExpression.getParent(); final PsiMethod method = methodCallExpression.resolveMethod(); if (method == null) return; final PsiField field = myGetter ? PropertyUtil.getFieldOfGetter(method) : PropertyUtil.getFieldOfSetter(method); if (field == null) return; final String name = field.getName(); final CommentTracker tracker = new CommentTracker(); @NonNls final StringBuilder newText = new StringBuilder(); final PsiExpression qualifier = methodExpression.getQualifierExpression(); if (qualifier != null) { newText.append(tracker.text(qualifier)).append('.'); } else { final PsiVariable variable = JavaPsiFacade.getInstance(project).getResolveHelper().resolveReferencedVariable(name, methodExpression); if (variable != field) newText.append("this."); } newText.append(name); if (!myGetter) { newText.append("=").append(methodCallExpression.getArgumentList().getExpressions()[0].getText()); } tracker.replaceAndRestoreComments(methodCallExpression, newText.toString()); }