Bug 4916 Potential IDE freeze on Template Preference Page
Comments from Adam Kiezun: SEVERE: 1. go to template pref page. 2. select the first one 3. edit the name - empty the field and then put a single space whole IDE freezes (infinite loop?)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/TemplatePreferencePage.java
status.setError(TemplateMessages.getString("TemplatePreferencePage.error.noname")); 
		setValid(!status.matches(IStatus.ERROR));
		StatusUtil.applyToStatusLine(this, status);			
	}
	
	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) {
		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("");