label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.addcast_var.description", typeName);
String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.addcast_var.description", typeName);
	public static void addCastProposals(ICorrectionContext context, List proposals) throws CoreException {		String[] args= context.getProblemArguments();		if (args.length != 2) {			return;		}					ICompilationUnit cu= context.getCompilationUnit();		String castType= args[1];		CompilationUnit astRoot= context.getASTRoot();		ASTNode selectedNode= context.getCoveredNode();		if (!(selectedNode instanceof Expression)) {			return;		}		Expression nodeToCast= (Expression) selectedNode;				int parentNodeType= selectedNode.getParent().getNodeType();		if (parentNodeType == ASTNode.ASSIGNMENT) {			Assignment assign= (Assignment) selectedNode.getParent();			if (selectedNode.equals(assign.getLeftHandSide())) {				nodeToCast= assign.getRightHandSide();			}		} else if (parentNodeType == ASTNode.VARIABLE_DECLARATION_FRAGMENT) {			VariableDeclarationFragment frag= (VariableDeclarationFragment) selectedNode.getParent();			if (selectedNode.equals(frag.getName())) {				nodeToCast= frag.getInitializer();			}		}				ASTRewrite rewrite= new ASTRewrite(nodeToCast.getParent());		String label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.addcast.description", castType); //$NON-NLS-1$		Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);		ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 1, image);		String simpleCastType= proposal.addImport(castType);			Expression expressionCopy= (Expression) rewrite.createCopy(nodeToCast);		Type typeCopy= (Type) rewrite.createPlaceholder(simpleCastType, ASTRewrite.TYPE);		CastExpression castExpression= astRoot.getAST().newCastExpression();		castExpression.setExpression(expressionCopy);		castExpression.setType(typeCopy);				rewrite.markAsReplaced(nodeToCast, castExpression);		proposal.ensureNoModifications();				proposals.add(proposal);				if (parentNodeType == ASTNode.VARIABLE_DECLARATION_FRAGMENT) {			VariableDeclarationFragment fragment= (VariableDeclarationFragment) selectedNode.getParent();			ASTNode parent= fragment.getParent();			Type type= null;			if (parent instanceof VariableDeclarationStatement) {				VariableDeclarationStatement stmt= (VariableDeclarationStatement) parent;				if (stmt.fragments().size() == 1) {					type= stmt.getType();				}			} else if (parent instanceof FieldDeclaration) {				FieldDeclaration decl= (FieldDeclaration) parent;				if (decl.fragments().size() == 1) {					type= decl.getType();				}			}						if (type != null) {				ImportEdit edit= new ImportEdit(cu, JavaPreferencesSettings.getCodeGenerationSettings());				String typeName= edit.addImport(args[0]);				label= CorrectionMessages.getFormattedString("LocalCorrectionsSubProcessor.addcast_var.description", typeName); //$NON-NLS-1$				ReplaceCorrectionProposal varProposal= new ReplaceCorrectionProposal(label, cu, type.getStartPosition(), type.getLength(), typeName, 1);				varProposal.getRootTextEdit().add(edit);					proposals.add(varProposal);			}		}				}