Bug 4360 Template - cursor at wrong position
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/template/TemplateProposal.java
fSelectionStart= pattern.length();
				fSelectionEnd= fSelectionStart;
			} else {
				fSelectionStart= selection[0];
				fSelectionEnd= selection[1];
			}
		}
		if (TemplatePreferencePage.useCodeFormatter() && fTemplate.getContext().equals("java")) { 
			CodeFormatter formatter= new CodeFormatter(JavaCore.getOptions());
			formatter.setPositionsToMap(new int[] {fSelectionStart, fSelectionEnd});
			formatter.setInitialIndentationLevel(indentationLevel);
			pattern= formatter.formatSourceString(pattern);
			
			int[] positions= formatter.getMappedPositions();
			fSelectionStart= positions[0];
			fSelectionEnd= positions[1];
		} else {
			CodeIndentator indentator= new CodeIndentator();
			indentator.setPositionsToMap(new int[] {fSelectionStart, fSelectionEnd});
			indentator.setIndentationLevel(indentationLevel);
			
			pattern= indentator.indentate(pattern);
			int[] positions= indentator.getMappedPositions();
			fSelectionStart= positions[0];
			fSelectionEnd= positions[1];	
		}
		
		String finalString= trimBegin(pattern);
		int charactersRemoved= pattern.length() - finalString.length();
		fSelectionStart -= charactersRemoved;