void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiIfStatement ifStatement = PsiTreeUtil.getParentOfType(element, PsiIfStatement.class); if (ifStatement == null) return; IfConditionalModel model = IfConditionalModel.from(ifStatement, false); if (model == null) return; ConditionalExpressionGenerator generator = ConditionalExpressionGenerator.from(model); if (generator == null) return; CommentTracker commentTracker = new CommentTracker(); String conditional = generator.generate(commentTracker); commentTracker.replace(model.getThenExpression(), conditional); PsiStatement branch = model.getElseBranch(); if (!PsiTreeUtil.isAncestor(ifStatement, branch, true) && !(branch instanceof PsiDeclarationStatement)) { commentTracker.delete(branch); } PsiElement result = commentTracker.replaceAndRestoreComments(ifStatement, model.getThenBranch()); tryJoinDeclaration(result); }