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
fFormatButton= new Button(secondPage, SWT.CHECK);
		fFormatButton.setText(TemplateMessages.getString("TemplatePreferencePage.use.code.formatter")); 
		IPreferenceStore prefs= JavaPlugin.getDefault().getPreferenceStore();
		fFormatButton.setSelection(prefs.getBoolean(PREF_FORMAT_TEMPLATES));
		
		fTableViewer.setInput(TemplateSet.getInstance());		
		fTableViewer.setAllChecked(false);
		fTableViewer.setCheckedElements(getEnabledTemplates());		
		updateButtons();
		WorkbenchHelp.setHelp(parent, new DialogPageContextComputer(this, IJavaHelpContextIds.JRE_PREFERENCE_PAGE));		
		leaveEditor();
		
		return parent;
	}
	
	private Template[] getEnabledTemplates() {
		Template[] templates= TemplateSet.getInstance().getTemplates();
		
		List list= new ArrayList(templates.length);
		
		for (int i= 0; i != templates.length; i++)
			if (templates[i].isEnabled())
				list.add(templates[i]);
				
		return (Template[]) list.toArray(new Template[list.size()]);
	}
	private static Label createLabel(Composite parent, String name) {
		Label label= new Label(parent, SWT.NULL);
		label.setText(name);
		label.setLayoutData(new GridData());