int start= context.getStart(); try { doc.replace(start, context.getEnd() - start, string); } catch (BadLocationException e) { return; }
	private void plainFormat(TemplateBuffer templateBuffer, JavaContext context) {				String string= templateBuffer.getString();		IDocument doc= new Document(context.getDocument().get());				int start= context.getStart();		try {			doc.replace(start, context.getEnd() - start, string);		} catch (BadLocationException e) {			return; // don't format if the document has changed		}		TemplateVariable[] variables= templateBuffer.getVariables();		int[] offsets= variablesToOffsets(variables, start);				Map options;		if (context.getCompilationUnit() != null)			options= context.getCompilationUnit().getJavaProject().getOptions(true); 		else			options= JavaCore.getOptions();				string= CodeFormatterUtil.format(CodeFormatter.K_COMPILATION_UNIT, doc.get(), start, string.length(), 0, offsets, fLineDelimiter, options);				offsetsToVariables(offsets, variables, start);		templateBuffer.setContent(string, variables);	    	}