code: void enableTemplates() {
  		boolean enabled = fUseTemplateButton.getSelection();
  
  		if (!enabled) {
  			// save last selected template
  			Template template = getSelectedTemplate();
  			if (template != null)
  				fLastSelectedTemplateName = template.getName();
  			else
  				fLastSelectedTemplateName = ""; //$NON-NLS-1$
  
  			fTableViewer.setSelection(null);
  		}
  		else {
  			setSelectedTemplate(fLastSelectedTemplateName);
  		}
  
  		fTableViewer.getControl().setEnabled(enabled);
  		fPatternViewer.getControl().setEnabled(enabled);
  	}
docs: Enable/disable controls in page based on fUseTemplateButton's current
  state.