Bug 153040 Template definition should be removed after the report item is deleted
Steps to reproduce: 1.New a report, extends lib.label 2.Convert the label to template report item, and revert it back to the report item 3.Delete the label 4.Remove the included library Expected result: Library can be removed Actual result: A BIRT exception occurred. Plug-in Provider:Eclipse.org Plug-in Name:BIRT Model Plug-in ID:org.eclipse.birt.report.model Version:2.1.0.v20060808-0630 Error Code:Error.LibraryException.LIBRARY_HAS_DESCENDENTS Error Message:The library "Lib" can no be dropped because it has descendents "NewLabel" in the current module.
model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/command/ContentCommand.java
ContentException.DESIGN_EXCEPTION_CONTENT_NAME_REQUIRED );
		}
		
		ContainerSlot slot = element.getSlot( slotID );
		if ( !slot.contains( oldElement ) )
			throw new ContentException( element, slotID, oldElement,
					ContentException.DESIGN_EXCEPTION_CONTENT_NOT_FOUND );
		
		if ( oldElement instanceof TemplateElement )
		{
			if ( !oldElement.canDrop( )
					|| !oldElement.isTemplateParameterValue( module )
					|| !newElement.getDefn( ).isKindOf(
							( (TemplateElement) oldElement ).getDefaultElement(
									module ).getDefn( ) ) )
				throw new TemplateException(
						oldElement,
						TemplateException.DESIGN_EXCEPTION_REVERT_TO_TEMPLATE_FORBIDDEN );
		}
		else
		{
			if ( !oldElement.canTransformToTemplate( module )
					|| !( newElement instanceof TemplateElement ) )
				throw new ContentException(
						element,
						slotID,
						ContentException.DESIGN_EXCEPTION_TEMPLATE_TRANSFORM_FORBIDDEN );
		}