Bug 115513 [quick assist] Surround with template
Version: 3.2.0 Build id: I20051102-1600 Surround with template is an enhancement of surround with runnable. It adds logic to the 'surround with' templates. Users can define there own templates to surround code with (i.e. 'surround with ISafeRunnable').
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/SurroundWithRunnableProposal.java
fragmentsRewrite= rewrite.getListRewrite(newStatement, VariableDeclarationStatement.FRAGMENTS_PROPERTY);
					
					lastStatement= newStatement;
			} else if (fragmentsRewrite != null) {
				ASTNode fragment0= rewrite.createMoveTarget(currentFragment);
				fragmentsRewrite.insertLast(fragment0, null);
			}
			lastFragment= currentFragment;
		}
	}
	/**
	 * Split off initializer in <code>fragment</code> (if any) and add it as a new expression at the end of <code>statements</code>.
	 * @param statements The home of the new expression.
	 * @param fragment Thr fragment to split.
	 * @param rewrite The rewrite to use.
	 */
	private static void splitOffInitializer(ListRewrite statements, VariableDeclarationFragment fragment, ASTRewrite rewrite) {
		Expression initializer= fragment.getInitializer();
		if (initializer != null) {
			AST ast= statements.getASTRewrite().getAST();
			Assignment assignment= ast.newAssignment();
			assignment.setLeftHandSide((Expression)rewrite.createCopyTarget(fragment.getName()));
			assignment.setRightHandSide((Expression)rewrite.createMoveTarget(initializer));
			statements.insertLast(ast.newExpressionStatement(assignment), null);
		}
	}
	
	/**
	 * Make statement final