markAsLinked(rewrite, newDeclFrag.getName(), true, KEY_NAME); markAsLinked(rewrite, newDecl.getType(), false, KEY_TYPE); markAsSelection(rewrite, newDecl);
addLinkedPosition(rewrite.track(newDeclFrag.getName()), true, KEY_NAME); addLinkedPosition(rewrite.track(newDecl.getType()), false, KEY_TYPE); setEndPosition(rewrite.track(newDecl));
	private ASTRewrite doAddLocal() throws CoreException {		Expression expression= ((ExpressionStatement) fNodeToAssign).getExpression();		AST ast= fNodeToAssign.getAST();				ASTRewrite rewrite= new ASTRewrite(ast);		String varName= suggestLocalVariableNames(fTypeBinding);						VariableDeclarationFragment newDeclFrag= ast.newVariableDeclarationFragment();		newDeclFrag.setName(ast.newSimpleName(varName));		newDeclFrag.setInitializer((Expression) rewrite.createCopyTarget(expression));				// trick for bug 43248: use an VariableDeclarationExpression and keep the ExpressionStatement		VariableDeclarationExpression newDecl= ast.newVariableDeclarationExpression(newDeclFrag);				Type type= evaluateType(ast);		newDecl.setType(type);				rewrite.replace(expression, newDecl, null); 				markAsLinked(rewrite, newDeclFrag.getName(), true, KEY_NAME); //$NON-NLS-1$		markAsLinked(rewrite, newDecl.getType(), false, KEY_TYPE); //$NON-NLS-1$		markAsSelection(rewrite, newDecl);		return rewrite;	}