Bug 124336 Template report items corrupt report design
Steps: 1-Create a new blank report 2-Drop an element on the report (any element will do: label, chart, ...) 3-Right click and choose create template report item 4-Enter a description and click OK 5-Double click on the element (it reverts to a simple report item) 6- Perform steps 3 to 5 several times 7- The report only shows one item, but if you click on XML Source you will see several entries (as many as you repeated the steps), although there should be only one <template-parameter-definition name="NewTemplateParameterDefinition" id="5"> <property name="allowedType">Label</property> <text-property name="description">aa</text-property> <default> <label id="6"> <text-property name="text">aaa</text-property> </label> </default> </template-parameter-definition> <template-parameter-definition name="NewTemplateParameterDefinition1" id="9"> <property name="allowedType">Label</property> <text-property name="description">ff</text-property> <default> <label id="10"> <property name="refTemplateParameter">NewTemplateParameterDefinition</property> <text-property name="text">aaa</text-property> </label> </default> </template-parameter-definition> <template-parameter-definition name="NewTemplateParameterDefinition2" id="13"> <property name="allowedType">Label</property> <text-property name="description">ii</text-property> <default> <label id="14"> <property name="refTemplateParameter">NewTemplateParameterDefinition1</property> <text-property name="text">aaa</text-property> </label> </default> </template-parameter-definition>
model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/command/TemplateCommand.java
*            the module of the template element
	 * @param name
	 *            the name to resolve
	 * @return the element reference value
	 */
	private TemplateParameterDefinition resolveTemplateParameterDefinition(
			Module module, String name )
	{
		PropertyDefn prop = element
				.getPropertyDefn( DesignElement.REF_TEMPLATE_PARAMETER_PROP );
		if ( prop == null )
			return null;
		ElementDefn targetDefn = (ElementDefn) prop.getTargetElementType( );
		DesignElement resolvedElement = module.resolveElement( name, targetDefn
				.getNameSpaceID( ), (ElementPropertyDefn) prop );
		
		
		
		
		return (TemplateParameterDefinition) resolvedElement;
	}
	/**
	 * Checks the validation of the template element to insert. Verify that the
	 * template element to insert refers a valid and exsiting template parameter
	 * definition. If the referred the template definition doesn't exsit, then
	 * return the template parameter definition to add it to the module.
	 * 
	 * @param content
	 * @param slotID
	 * @return a template parameter definition to add, otherwise null