void (@NotNull PsiElement element) { final PsiReferenceExpression operandExpression = IncrementUtil.getIncrementOrDecrementOperand(element); final PsiExpressionStatement expressionStatement = ObjectUtils.tryCast(element.getParent(), PsiExpressionStatement.class); final String operatorText = IncrementUtil.getOperatorText(element); if (operandExpression != null && expressionStatement != null && operatorText != null) { final PsiVariable variable = resolveSimpleVariableReference(operandExpression); if (variable != null) { final Occurrence occurrence = findSingleReadOccurrence(expressionStatement, variable); if (occurrence != null) { final Project project = expressionStatement.getProject(); final PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory(); final String text = occurrence.isPrevious ? occurrence.referenceExpression.getText() + operatorText : operatorText + occurrence.referenceExpression.getText(); PsiExpression incrementOrDecrement = factory.createExpressionFromText(text, expressionStatement); incrementOrDecrement = (PsiExpression)occurrence.referenceExpression.replace(incrementOrDecrement); final CodeStyleManager codeStyle = CodeStyleManager.getInstance(project); codeStyle.reformat(incrementOrDecrement, true); final CommentTracker ct = new CommentTracker(); ct.deleteAndRestoreComments(expressionStatement); } } } }