private static int getCaretOffset(TemplateBuffer buffer) {
private int getCaretOffset(TemplateBuffer buffer) {  if (fContext instanceof DocumentTemplateContext && ((DocumentTemplateContext) fContext).getCompletionLength() != 0) { return buffer.getString().length(); }
	private static int getCaretOffset(TemplateBuffer buffer) {	    TemplatePosition[] variables= buffer.getVariables();		for (int i= 0; i != variables.length; i++) {			TemplatePosition variable= variables[i];						if (variable.getName().equals(JavaTemplateMessages.getString("GlobalVariables.variable.name.cursor"))) //$NON-NLS-1$				return variable.getOffsets()[0];		}		return buffer.getString().length();	}