void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { if (!(element instanceof GrConditionalExpression condExp)) { throw new IncorrectOperationException("Not invoked on a conditional"); } GrExpression thenBranch = condExp.getThenBranch(); GrExpression elseBranch = condExp.getElseBranch(); Object thenVal = GroovyConstantExpressionEvaluator.evaluate(thenBranch); if (Boolean.TRUE.equals(thenVal) && elseBranch != null) { // aaa ? true : bbb -> aaa || bbb GrExpression conditionExp = condExp.getCondition(); String conditionExpText = getStringToPutIntoOrExpression(conditionExp); String elseExpText = getStringToPutIntoOrExpression(elseBranch); String newExp = conditionExpText + "||" + elseExpText; manageReplace(updater, condExp, conditionExpText, newExp); return; } Object elseVal = GroovyConstantExpressionEvaluator.evaluate(elseBranch); if (Boolean.FALSE.equals(elseVal) && thenBranch != null) { // aaa ? bbb : false -> aaa && bbb GrExpression conditionExp = condExp.getCondition(); String conditionExpText = getStringToPutIntoAndExpression(conditionExp); String thenExpText = getStringToPutIntoAndExpression(thenBranch); String newExp = conditionExpText + "&&" + thenExpText; manageReplace(updater, condExp, conditionExpText, newExp); } }