DesignElementHandle childElement = null; if ( baseElement instanceof ExtendedItemHandle ) { String extensionName = baseElement .getStringProperty( ExtendedItem.EXTENSION_NAME_PROP ); childElement = this.newExtendedItem( name, extensionName, (ExtendedItemHandle) base.getHandle( lib ) ); childElement.getElement( ).refreshStructureFromParent( module ); } else { childElement = newElement( base.getElementName( ), name ); childElement.setExtends( base.getHandle( lib ) ); childElement.getElement( ).refreshStructureFromParent( module ); }  return childElement;
return newElementFrom( name, base.getHandle( lib ) );
	public DesignElementHandle newElementFrom( DesignElementHandle baseElement,			String name ) throws ExtendsException	{		if ( baseElement == null )			return null;		// if the base element is in the module, just generate a child element		if ( baseElement.getRoot( ).getElement( ) == module )		{			DesignElementHandle childElement = null;			if ( baseElement instanceof ExtendedItemHandle )			{				String extensionName = baseElement						.getStringProperty( ExtendedItem.EXTENSION_NAME_PROP );				childElement = this.newExtendedItem( name, extensionName,						(ExtendedItemHandle) baseElement );				childElement.getElement( ).refreshStructureFromParent( module );			}			else			{				childElement = newElement( baseElement.getElement( )						.getElementName( ), name );				childElement.setExtends( baseElement );				childElement.getElement( ).refreshStructureFromParent( module );			}			return childElement;		}		// the base element is not in the module, check whether the root module		// of the base element is included		Module root = (Module) baseElement.getRoot( ).getElement( );		if ( root instanceof Library )		{			// the library with the location path is never included			Library lib = module.getLibraryByLocation( root.getLocation( ) );			if ( lib == null )			{				throw new ExtendsException( null, baseElement.getElement( ),						ExtendsException.DESIGN_EXCEPTION_PARENT_NOT_INCLUDE );			}			DesignElement base = lib.getElementByID( baseElement.getID( ) );			// if the element with the name is not found or the element type			// is inconsistent, throw an exception			if ( base == null					|| base.getDefn( ) != baseElement.getElement( ).getDefn( ) )			{				throw new ExtendsException( null, baseElement.getName( ),						ExtendsException.DESIGN_EXCEPTION_NOT_FOUND );			}			DesignElementHandle childElement = null;			if ( baseElement instanceof ExtendedItemHandle )			{				String extensionName = baseElement						.getStringProperty( ExtendedItem.EXTENSION_NAME_PROP );				childElement = this.newExtendedItem( name, extensionName,						(ExtendedItemHandle) base.getHandle( lib ) );				childElement.getElement( ).refreshStructureFromParent( module );			}			else			{				childElement = newElement( base.getElementName( ), name );				childElement.setExtends( base.getHandle( lib ) );				childElement.getElement( ).refreshStructureFromParent( module );			}			return childElement;		}		// if the root element is report design, return null		return null;	}