private boolean getAddBlockProposals(IInvocationContext context, ASTNode node, Collection resultingCollections) {
private static boolean getAddBlockProposals(IInvocationContext context, ASTNode node, Collection resultingCollections) {
	private boolean getAddBlockProposals(IInvocationContext context, ASTNode node, Collection resultingCollections) {		Statement statement= ASTResolving.findParentStatement(node);		if (statement == null) {			return false;		}		if (!isControlStatementWithBlock(statement)) {			if (!isControlStatementWithBlock(statement.getParent())) {				return false;			}			int statementStart= statement.getStartPosition();			int statementEnd= statementStart + statement.getLength();			int offset= context.getSelectionOffset();			int length= context.getSelectionLength();			if (length == 0) {				if (offset != statementEnd) { // cursor at end					return false;				}			} else {				if (offset > statementStart || offset + length < statementEnd) { // statement selected					return false;				}			}			statement= (Statement) statement.getParent();		}		StructuralPropertyDescriptor childProperty= null;		ASTNode child= null;		switch (statement.getNodeType()) {			case ASTNode.IF_STATEMENT:				int selectionStart= context.getSelectionOffset();				int selectionEnd= context.getSelectionOffset() + context.getSelectionLength();				ASTNode then= ((IfStatement) statement).getThenStatement();				if (selectionEnd <= then.getStartPosition() + then.getLength()) {					if (!(then instanceof Block)) {						childProperty= IfStatement.THEN_STATEMENT_PROPERTY;						child= then;					}				} else if (selectionStart >=  then.getStartPosition() + then.getLength()) {					ASTNode elseStatement= ((IfStatement) statement).getElseStatement();					if (!(elseStatement instanceof Block)) {						childProperty= IfStatement.ELSE_STATEMENT_PROPERTY;						child= elseStatement;					}				}				break;			case ASTNode.WHILE_STATEMENT:				ASTNode whileBody= ((WhileStatement) statement).getBody();				if (!(whileBody instanceof Block)) {					childProperty= WhileStatement.BODY_PROPERTY;					child= whileBody;				}				break;			case ASTNode.FOR_STATEMENT:				ASTNode forBody= ((ForStatement) statement).getBody();				if (!(forBody instanceof Block)) {					childProperty= ForStatement.BODY_PROPERTY;					child= forBody;				}				break;			case ASTNode.DO_STATEMENT:				ASTNode doBody= ((DoStatement) statement).getBody();				if (!(doBody instanceof Block)) {					childProperty= DoStatement.BODY_PROPERTY;					child= doBody;				}				break;			default:		}		if (child == null) {			return false;		}		if (resultingCollections == null) {			return true;		}		AST ast= statement.getAST();		{			ASTRewrite rewrite= ASTRewrite.create(ast);			ASTNode childPlaceholder= rewrite.createMoveTarget(child);			Block replacingBody= ast.newBlock();			replacingBody.statements().add(childPlaceholder);			rewrite.set(statement, childProperty, replacingBody, null);			String label;			if (childProperty == IfStatement.THEN_STATEMENT_PROPERTY) {				label = CorrectionMessages.QuickAssistProcessor_replacethenwithblock_description;			} else if (childProperty == IfStatement.ELSE_STATEMENT_PROPERTY) {				label = CorrectionMessages.QuickAssistProcessor_replaceelsewithblock_description;			} else {				label = CorrectionMessages.QuickAssistProcessor_replacebodywithblock_description;			}			Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);			LinkedCorrectionProposal proposal= new LinkedCorrectionProposal(label, context.getCompilationUnit(), rewrite, 10, image);			proposal.setCommandId(ADD_BLOCK_ID);			proposal.setEndPosition(rewrite.track(child));			resultingCollections.add(proposal);		}		if (statement.getNodeType() == ASTNode.IF_STATEMENT) {			IfStatement ifStatement= (IfStatement) statement;			Statement thenStatment= ifStatement.getThenStatement();			Statement elseStatment= ifStatement.getElseStatement();			// add then _and_ else blocks			if ((childProperty == IfStatement.THEN_STATEMENT_PROPERTY && elseStatment != null && !(elseStatment instanceof Block))				|| (childProperty == IfStatement.ELSE_STATEMENT_PROPERTY && !(thenStatment instanceof Block))) {				ASTRewrite rewrite= ASTRewrite.create(ast);				ASTNode childPlaceholder1= rewrite.createMoveTarget(thenStatment);				Block replacingBody1= ast.newBlock();				replacingBody1.statements().add(childPlaceholder1);				rewrite.set(statement, IfStatement.THEN_STATEMENT_PROPERTY, replacingBody1, null);				ASTNode childPlaceholder2= rewrite.createMoveTarget(elseStatment);				Block replacingBody2= ast.newBlock();				replacingBody2.statements().add(childPlaceholder2);				rewrite.set(statement, IfStatement.ELSE_STATEMENT_PROPERTY, replacingBody2, null);				String label = CorrectionMessages.QuickAssistProcessor_replacethenelsewithblock_description;				Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);				LinkedCorrectionProposal proposal= new LinkedCorrectionProposal(label, context.getCompilationUnit(), rewrite, 10, image);				proposal.setEndPosition(rewrite.track(elseStatment));				resultingCollections.add(proposal);			}		}		return true;	}