Bug 4139 EC DCR: Code templates feature (1GIVMDV)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/template/TemplateSet.java
/**
	 * Resets the template set with the default templates.
	 */
	public void restoreDefaults() {
		clear();
		addFromStream(getDefaultsAsStream());
	}
	
	/**
	 * Resets (reloads) the template set.
	 */
	public void reset() {
		clear();
		try {
			addFromStream(new FileInputStream(getTemplateFile()));
		} catch (FileNotFoundException e) {
			JavaPlugin.log(e);
		}
	}
	private boolean addFromStream(InputStream stream) {
		try {
			TemplateSet templateSet= new TemplateSet();
			
			DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
			DocumentBuilder parser= factory.newDocumentBuilder();		
			Document document= parser.parse(new InputSource(stream));
			NodeList elements= document.getElementsByTagName(TEMPLATE_TAG);
			
			int count= elements.getLength();
			for (int i= 0; i != count; i++) {