Expression leftCondition = null; Expression rightCondition = null; Expression currentExpression = infixExpression; while (true) { if (leftCondition == null) { Expression leftOperand = ((InfixExpression) currentExpression).getLeftOperand(); if (leftOperand instanceof ParenthesizedExpression) leftOperand = ((ParenthesizedExpression) leftOperand).getExpression(); Expression leftPlaceholder = (Expression) rewrite.createCopyTarget(leftOperand); leftCondition = leftPlaceholder; } Expression rightOperand = ((InfixExpression) currentExpression).getRightOperand(); if (rightCondition == null) { if (rightOperand instanceof ParenthesizedExpression) rightOperand = ((ParenthesizedExpression) rightOperand).getExpression(); Expression rightPlaceholder = (Expression) rewrite.createCopyTarget(rightOperand); rightCondition = rightPlaceholder; } else { Expression rightPlaceholder = (Expression) rewrite.createCopyTarget(rightOperand); InfixExpression infix = ast.newInfixExpression(); infix.setOperator(orOperator); infix.setLeftOperand(rightCondition); infix.setRightOperand(rightPlaceholder); rightCondition = infix; } if (currentExpression.getParent() == ifStatement) break; currentExpression = (Expression) currentExpression.getParent(); }
Expression[] newOperands= { null, null }; breakInfixOperationAtOperation(rewrite, topInfixExpression, orOperator, offset, true, newOperands);  Expression leftCondition= newOperands[0]; Expression rightCondition= newOperands[1];
	private static boolean getSplitOrConditionProposals(IInvocationContext context, ASTNode node,			Collection resultingCollections) {		Operator orOperator = InfixExpression.Operator.CONDITIONAL_OR;		// check that user invokes quick assist on infix expression		if (!(node instanceof InfixExpression)) {			return false;		}		InfixExpression infixExpression = (InfixExpression) node;		if (infixExpression.getOperator() != orOperator) {			return false;		}		// check that infix expression belongs to IfStatement		Statement statement = ASTResolving.findParentStatement(node);		if (!(statement instanceof IfStatement)) {			return false;		}		IfStatement ifStatement = (IfStatement) statement;		if (ifStatement.getElseStatement() != null) {			return false;		}		// check that infix expression is part of first level || condition of IfStatement		InfixExpression topInfixExpression = infixExpression;		while ((topInfixExpression.getParent() instanceof InfixExpression)				&& ((InfixExpression) topInfixExpression.getParent()).getOperator() == orOperator) {			topInfixExpression = (InfixExpression) topInfixExpression.getParent();		}		if (ifStatement.getExpression() != topInfixExpression) {			return false;		}		//		if (resultingCollections == null) {			return true;		}		AST ast = ifStatement.getAST();		ASTRewrite rewrite = ASTRewrite.create(ast);		// prepare left and right conditions		Expression leftCondition = null;		Expression rightCondition = null;		Expression currentExpression = infixExpression;		while (true) {			if (leftCondition == null) {				Expression leftOperand = ((InfixExpression) currentExpression).getLeftOperand();				if (leftOperand instanceof ParenthesizedExpression)					leftOperand = ((ParenthesizedExpression) leftOperand).getExpression();				Expression leftPlaceholder = (Expression) rewrite.createCopyTarget(leftOperand);				leftCondition = leftPlaceholder;			}			Expression rightOperand = ((InfixExpression) currentExpression).getRightOperand();			if (rightCondition == null) {				if (rightOperand instanceof ParenthesizedExpression)					rightOperand = ((ParenthesizedExpression) rightOperand).getExpression();				Expression rightPlaceholder = (Expression) rewrite.createCopyTarget(rightOperand);				rightCondition = rightPlaceholder;			} else {				Expression rightPlaceholder = (Expression) rewrite.createCopyTarget(rightOperand);				InfixExpression infix = ast.newInfixExpression();				infix.setOperator(orOperator);				infix.setLeftOperand(rightCondition);				infix.setRightOperand(rightPlaceholder);				rightCondition = infix;			}			if (currentExpression.getParent() == ifStatement)				break;			currentExpression = (Expression) currentExpression.getParent();		}		// prepare first statement		IfStatement firstIf = ast.newIfStatement();		firstIf.setExpression(leftCondition);		firstIf.setThenStatement((Statement) rewrite.createCopyTarget(ifStatement.getThenStatement()));		// prepare second statement		IfStatement secondIf = ast.newIfStatement();		secondIf.setExpression(rightCondition);		secondIf.setThenStatement((Statement) rewrite.createCopyTarget(ifStatement.getThenStatement()));		// add first and second IfStatement's		Block sourceBlock = (Block) ifStatement.getParent();		int insertIndex = sourceBlock.statements().indexOf(ifStatement);		ListRewrite listRewriter = rewrite.getListRewrite(sourceBlock,			(ChildListPropertyDescriptor) statement.getLocationInParent());		listRewriter.replace(ifStatement, firstIf, null);		listRewriter.insertAt(secondIf, insertIndex + 1, null);		// add correction proposal		String label = CorrectionMessages.AdvancedQuickAssistProcessor_splitOrCondition_description;		Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);		ASTRewriteCorrectionProposal proposal = new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(),				rewrite, 1, image);		resultingCollections.add(proposal);		return true;	}