nameCmd.addElement( );
addElementNames( content );
	private void doAdd( DesignElement content, int slotID, int newPos )			throws ContentException, NameException	{		assert content.getContainer( ) == null;		// Ensure that the content can be put into the container.		ElementDefn metaData = (ElementDefn) element.getDefn( );		if ( !metaData.isContainer( ) )			throw new ContentException( element, slotID,					ContentException.DESIGN_EXCEPTION_NOT_CONTAINER );		SlotDefn slotInfo = (SlotDefn) metaData.getSlot( slotID );		if ( slotInfo == null )			throw new ContentException( element, slotID,					ContentException.DESIGN_EXCEPTION_SLOT_NOT_FOUND );		if ( !slotInfo.canContain( content ) )			throw new ContentException( element, slotID,					ContentException.DESIGN_EXCEPTION_WRONG_TYPE );		// This element is already the content of the element to add.		if ( element.isContentOf( content ) )			throw new ContentException( element, slotID, content,					ContentException.DESIGN_EXCEPTION_RECURSIVE );		// If this is a single-item slot, ensure that the slot is empty.		if ( !slotInfo.isMultipleCardinality( )				&& element.getSlot( slotID ).getCount( ) > 0 )		{			throw new ContentException( element, slotID,					ContentException.DESIGN_EXCEPTION_SLOT_IS_FULL );		}		if ( slotID == Module.COMPONENT_SLOT )		{			if ( StringUtil.isBlank( content.getName( ) ) )				throw new ContentException( element, slotID,content,						ContentException.DESIGN_EXCEPTION_CONTENT_NAME_REQUIRED );		}				if ( !element.canContain( module, slotID, content ) )			throw new ContentException(					element,					slotID,					content,					ContentException.DESIGN_EXCEPTION_INVALID_CONTEXT_CONTAINMENT );		// Ensure we can add the name.		NameCommand nameCmd = new NameCommand( module, content );		nameCmd.checkName( );		// Add the item to the container.		ContentRecord addRecord;		if ( newPos == -1 )		{			addRecord = new ContentRecord( module, element, slotID, content,					true );		}		else		{			addRecord = new ContentRecord( module, element, slotID, content,					newPos );		}		ActivityStack stack = getActivityStack( );		stack.startTrans( addRecord.getLabel( ) );		stack.execute( addRecord );		nameCmd.addElement( );		stack.commit( );	}