void MainObjectMenuMetadataItemVisitor::visitColumn(Column& column)
{
    addGenerateCodeMenu(column);
    // do not show for system tables or views
    if (!column.isSystem() && column.getTable() != 0)
    {
        addSeparator();
        addDropItem(column);
        addSeparator();
        // TODO: addRefreshItem();
        addPropertiesItem();
    }
}
Ejemplo n.º 2
0
bool ColumnPropertiesHandler::handleURI(URI& uri)
{
    bool addField = uri.action == "add_field";
    bool editField = uri.action == "edit_field";
    if (!addField && !editField)
        return false;

    wxWindow* w = getParentWindow(uri);
    MetadataItem* mo = extractMetadataItemFromURI<MetadataItem>(uri);
    if (!mo || !w)
        return true;

    Column* c = 0;
    Table* t;
    if (addField)
        t = (Table*)mo;
    else
    {
        c = (Column*)mo;
        t = c->getTable();
    }

    wxString statements, title;
    {   // we want FPD to go out of scope and get destroyed since the action in
        // ESF can destroy the field, and take down the FPD. Accessing FPD in turn
        // leads to mysterious crash
        FieldPropertiesDialog fpd(w, t, c);
        // NOTE: this has been moved here from OnOkButtonClick() to make frame
        //       activation work properly.  Basically activation of another
        //       frame has to happen outside wxDialog::ShowModal(), because it
        //       does at the end re-focus the last focused control, raising
        //       the parent frame over the newly created sql execution frame
        if (fpd.ShowModal() == wxID_OK)
        {
            statements = fpd.getStatementsToExecute();
            title = fpd.getStatementTitle();
        }
    }

    if (!statements.IsEmpty())
        execSql(w, title, t->getDatabase(), statements, true);
    return true;
}