/**
 * Adds pair to the list.
 */
void UMLForeignKeyConstraintDialog::slotAddPair()
{
    // get the index of the selected local column and referenced column
    int indexL = m_ColumnWidgets.localColumnCB->currentIndex();
    int indexR = m_ColumnWidgets.referencedColumnCB->currentIndex();

    if (indexL == -1 || indexR == -1) {
        return;
    }

    // local entity attribute
    UMLEntityAttribute* localColumn = m_pLocalAttributeList.at(indexL);
    // referenced entity attribute
    UMLEntityAttribute* referencedColumn = m_pReferencedAttributeList.at(indexR);

    // remove from combo boxes
    m_ColumnWidgets.localColumnCB->removeItem(indexL);
    m_ColumnWidgets.referencedColumnCB->removeItem(indexR);

    // remove from local cache
    m_pLocalAttributeList.removeAt(indexL);
    m_pReferencedAttributeList.removeAt(indexR);

    // add to local cache of mapping
    EntityAttributePair pair = qMakePair(localColumn, referencedColumn);
    m_pAttributeMapList.append(pair);
    // update mapping view

    QTreeWidgetItem* mapping = new QTreeWidgetItem(m_ColumnWidgets.mappingTW);
    mapping->setText(0, localColumn->toString(Uml::st_SigNoVis));
    mapping->setText(1, referencedColumn->toString(Uml::st_SigNoVis));

    m_ColumnWidgets.mappingTW->addTopLevelItem(mapping);

    slotResetWidgetState();
}