void (@NotNull PsiElement element) { final PsiConditionalExpression exp = (PsiConditionalExpression)element; final PsiExpression condition = exp.getCondition(); final PsiExpression elseExpression = exp.getElseExpression(); final PsiExpression thenExpression = exp.getThenExpression(); assert elseExpression != null; assert thenExpression != null; CommentTracker tracker = new CommentTracker(); final String newExpression = BoolUtils.getNegatedExpressionText(condition, tracker) + '?' + tracker.text(elseExpression) + ':' + tracker.text(thenExpression); PsiReplacementUtil.replaceExpression(exp, newExpression, tracker); }