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
return data;
	}
	
	private void selectionChanged1() {		
		IStructuredSelection selection= (IStructuredSelection) fTableViewer.getSelection();
		if (selection.size() == 1) {
			Template template= (Template) selection.getFirstElement();
			enterEditor(template);		
		} else {		
			leaveEditor();
		}
		
		updateButtons();
	}
	
	private void updateButtons() {
		int selectionCount= ((IStructuredSelection) fTableViewer.getSelection()).size();
		int itemCount= fTableViewer.getTable().getItemCount();
		
		boolean error= (fCurrent != null) && (fCurrent.getName().length() == 0);
		
		fAddButton.setEnabled(!error);
		fRemoveButton.setEnabled(selectionCount > 0 && selectionCount <= itemCount);
		fEnableAllButton.setEnabled(itemCount > 0);
		fDisableAllButton.setEnabled(itemCount > 0);
		StatusInfo status= new StatusInfo();
		if (error)
			status.setError(TemplateMessages.getString("TemplatePreferencePage.error.noname")); 
		setValid(!status.matches(IStatus.ERROR));
		StatusUtil.applyToStatusLine(this, status);