void (@NotNull Project project, @NotNull PsiElement startElement, @NotNull ModPsiUpdater updater) { final PsiPrefixExpression prefixExpr = ObjectUtils.tryCast(startElement.getParent(), PsiPrefixExpression.class); if (prefixExpr == null) { return; } final PsiExpression operand = prefixExpr.getOperand(); final PsiExpression oldExpr; final PsiReferenceExpression refExpr; if (operand instanceof PsiReferenceExpression) { oldExpr = (PsiExpression)prefixExpr.getParent(); refExpr = (PsiReferenceExpression)operand; } else if (operand instanceof PsiPrefixExpression) { oldExpr = prefixExpr; refExpr = (PsiReferenceExpression)((PsiPrefixExpression)operand).getOperand(); } else { return; } if (refExpr == null || oldExpr == null) { return; } final String refName = refExpr.getReferenceName(); if (refName == null) { return; } final String operatorText = myIncrement ? "++" : "--"; PsiReplacementUtil.replaceExpression(oldExpr, operatorText + refName); }