void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { final GrIfStatement parentStatement = (GrIfStatement) element; final GrStatement parentThenBranch = parentStatement.getThenBranch(); final GrIfStatement childStatement = (GrIfStatement) ConditionalUtils.stripBraces(parentThenBranch); final GrExpression childCondition = childStatement.getCondition(); final String childConditionText; if (ParenthesesUtils.getPrecedence(childCondition) > ParenthesesUtils.AND_PRECEDENCE) { childConditionText = '(' + childCondition.getText() + ')'; } else { childConditionText = childCondition.getText(); } final GrExpression parentCondition = parentStatement.getCondition(); final String parentConditionText; if (ParenthesesUtils.getPrecedence(parentCondition) > ParenthesesUtils.AND_PRECEDENCE) { parentConditionText = '(' + parentCondition.getText() + ')'; } else { parentConditionText = parentCondition.getText(); } final GrStatement childThenBranch = childStatement.getThenBranch(); @NonNls final String statement = "if(" + parentConditionText + "&&" + childConditionText + ')' + childThenBranch.getText(); PsiImplUtil.replaceStatement(statement, parentStatement); }