void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { if (!(element instanceof PsiBinaryExpression binaryExpression)) { return; } final PsiExpression lhs = PsiUtil.skipParenthesizedExprDown(binaryExpression.getLOperand()); final PsiExpression rhs = PsiUtil.skipParenthesizedExprDown(binaryExpression.getROperand()); if (!(lhs instanceof PsiBinaryExpression lBinaryExpression) || !(rhs instanceof PsiBinaryExpression rBinaryExpression)) { return; } final PsiExpression llhs = PsiUtil.skipParenthesizedExprDown(lBinaryExpression.getLOperand()); final PsiExpression lrhs = PsiUtil.skipParenthesizedExprDown(rBinaryExpression.getLOperand()); if (llhs == null || lrhs == null) { return; } final PsiExpression thenExpression = PsiUtil.skipParenthesizedExprDown(lBinaryExpression.getROperand()); final PsiExpression elseExpression = PsiUtil.skipParenthesizedExprDown(rBinaryExpression.getROperand()); if (thenExpression == null || elseExpression == null) { return; } CommentTracker commentTracker = new CommentTracker(); if (BoolUtils.isNegation(llhs) ) { PsiReplacementUtil.replaceExpression(binaryExpression, getText(lrhs, commentTracker) + '?' + getText(elseExpression, commentTracker) + ':' + getText(thenExpression, commentTracker), commentTracker); } else { PsiReplacementUtil.replaceExpression(binaryExpression, getText(llhs, commentTracker) + '?' + getText(thenExpression, commentTracker) + ':' + getText(elseExpression, commentTracker), commentTracker); } }