ifStatement.setThenStatement(createAssignmentStatement(rewrite, assignee, conditional.getThenExpression())); ifStatement.setElseStatement(createAssignmentStatement(rewrite, assignee, conditional.getElseExpression()));
ifStatement.setThenStatement(createAssignmentStatement(rewrite, op, assignee, conditional.getThenExpression())); ifStatement.setElseStatement(createAssignmentStatement(rewrite, op, assignee, conditional.getElseExpression()));
	private static boolean getReplaceConditionalWithIfElseProposals(IInvocationContext context, ASTNode covering, Collection resultingCollections) {		// check that parent statement is assignment		while (!(covering instanceof ConditionalExpression) && covering instanceof Expression) {			covering= covering.getParent();		}		if (!(covering instanceof ConditionalExpression)) {			return false;		}		StructuralPropertyDescriptor locationInParent= covering.getLocationInParent();		if (locationInParent == Assignment.RIGHT_HAND_SIDE_PROPERTY) {			if (covering.getParent().getLocationInParent() != ExpressionStatement.EXPRESSION_PROPERTY) {				return false;			}		} else if (locationInParent == VariableDeclarationFragment.INITIALIZER_PROPERTY) {			ASTNode statement= covering.getParent().getParent();			if (!(statement instanceof VariableDeclarationStatement) || statement.getLocationInParent() != Block.STATEMENTS_PROPERTY) {				return false;			}		} else if (locationInParent != ReturnStatement.EXPRESSION_PROPERTY) {			return false;		}		ConditionalExpression conditional= (ConditionalExpression) covering;		// ok, we could produce quick assist		if (resultingCollections == null) {			return true;		}		//		AST ast= covering.getAST();		ASTRewrite rewrite= ASTRewrite.create(ast);		// prepare new 'if' statement		Expression expression= conditional.getExpression();		while (expression instanceof ParenthesizedExpression) {			expression= ((ParenthesizedExpression) expression).getExpression();		}		IfStatement ifStatement= ast.newIfStatement();		ifStatement.setExpression((Expression) rewrite.createCopyTarget(expression));		if (locationInParent == Assignment.RIGHT_HAND_SIDE_PROPERTY) {			Expression assignee= ((Assignment) covering.getParent()).getLeftHandSide();			ifStatement.setThenStatement(createAssignmentStatement(rewrite, assignee, conditional.getThenExpression()));			ifStatement.setElseStatement(createAssignmentStatement(rewrite, assignee, conditional.getElseExpression()));			// replace return conditional expression with if/then/else/return			rewrite.replace(covering.getParent().getParent(), ifStatement, null);		} else if (locationInParent == ReturnStatement.EXPRESSION_PROPERTY) {			ifStatement.setThenStatement(createReturnExpression(rewrite, conditional.getThenExpression()));			ifStatement.setElseStatement(createReturnExpression(rewrite, conditional.getElseExpression()));			//			// replace return conditional expression with if/then/else/return			rewrite.replace(conditional.getParent(), ifStatement, null);		} else if (locationInParent == VariableDeclarationFragment.INITIALIZER_PROPERTY) {			VariableDeclarationFragment frag= (VariableDeclarationFragment) covering.getParent();			Expression assignee= frag.getName();			ifStatement.setThenStatement(createAssignmentStatement(rewrite, assignee, conditional.getThenExpression()));			ifStatement.setElseStatement(createAssignmentStatement(rewrite, assignee, conditional.getElseExpression()));			rewrite.set(frag, VariableDeclarationFragment.INITIALIZER_PROPERTY, null, null); // clear initializer			ASTNode statement= frag.getParent();			rewrite.getListRewrite(statement.getParent(), Block.STATEMENTS_PROPERTY).insertAfter(ifStatement, statement, null);		}		// add correction proposal		String label= CorrectionMessages.AdvancedQuickAssistProcessor_replaceConditionalWithIf;		Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);		ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), rewrite, 1, image);		resultingCollections.add(proposal);		return true;	}