Bug 66354 [quick fix] incorrect placement of new temp decl [quick fix]
3.0rc1 void foo(Object x) { if (x != null) foo= x.toString(); } select foo, choose 'create local variable foo' you get: void foo(Object x) { if (x != null)String foo = x.toString(); } which is somewhat suboptimal :)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/NewVariableCompletionProposal.java
if (statement instanceof ForStatement) {
			ForStatement forStatement= (ForStatement) statement;
			List list = forStatement.initializers();
			if (list.size() == 1 && list.get(0) instanceof Assignment) {
				Assignment assignment= (Assignment) list.get(0);
				return assignment.getLeftHandSide() == name;
			}
		}		
		return false;
	}
	
	private ASTRewrite doAddLocal(CompilationUnit cu) throws CoreException {
		AST ast= cu.getAST();
		
		Block body;
		BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(fOriginalNode);
		if (decl instanceof MethodDeclaration) {
			body= (((MethodDeclaration) decl).getBody());
		} else if (decl instanceof Initializer) {
			body= (((Initializer) decl).getBody());
		} else {
			return null;
		}
		ASTRewrite rewrite= ASTRewrite.create(ast);
		
		SimpleName[] names= getAllReferences(body);
		ASTNode dominant= getDominantNode(names);
		
		Statement dominantStatement= ASTResolving.findParentStatement(dominant);
		SimpleName node= names[0];