Bug 4358 Template - steals closing bracket
Steps to reproduce - press new - enter name for - enter description for(collection, type, var) - iterate over collection - enter pattern for (Iterator iter= ${0}.iterator; iter.hasNext(); ) { ${1} ${2}= (${1})iter.next(); ${cursor} - press return several times - position cursor after ${cursor} - press enter - press } - press OK - reopen dialog ==> observe: closing bracket } is missing.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/TemplatePreferencePage.java
}
	
	private static int getIndex(String context) {
		if (context.equals("java")) 
			return 0;
		else if (context.equals("javadoc")) 
			return 1;
		else
			return -1;
	}
	private void enterEditor(Template template) {
		if (template == fCurrent) 
			return;
		
		fCurrent= template;
	
		fNameText.setText(template.getName());
		fDescriptionText.setText(template.getDescription());
		fContextCombo.select(getIndex(template.getContext()));
		fPatternEditor.getDocument().set(template.getPattern());
		if (fEditorEnabler != null) {
			fEditorEnabler.restore();
			fEditorEnabler= null;
		}
	}
	
	private void leaveEditor() {
		fCurrent= null;
		fNameText.setText(""); 
		fDescriptionText.setText("");