Ejemplo n.º 1
0
void BrowserRegion::menu()
{
    QMenu m(name, 0);
    QMenu toolm(0);

    MenuFactory::createTitle(m, def->definition(FALSE, TRUE));
    m.addSeparator();

    if (!deletedp()) {
        if (!is_read_only) {
            MenuFactory::addItem(m, QObject::tr("New state"), 1,
                           QObject::tr("to add a <i>state</i> to the <i>region</i>"));
        }

        m.addSeparator();
        MenuFactory::addItem(m, QObject::tr("Edit"), 3,
                       QObject::tr("to edit the <i>region</i>, \
a double click with the left mouse button does the same thing"));

        if (!is_read_only && (edition_number == 0)) {
            m.addSeparator();
            MenuFactory::addItem(m, QObject::tr("Delete"), 7,
                           QObject::tr("to delete the <i>region</i>. \
Note that you can undelete it after"));
        }

        mark_menu(m, QObject::tr("the region").toLatin1().constData(), 90);
        ProfiledStereotypes::menu(m, this, 99990);

        if ((edition_number == 0) &&
            Tool::menu_insert(&toolm, get_type(), 100)) {
            m.addSeparator();
            toolm.setTitle(QObject::tr(("Tool")));
            m.addMenu(&toolm);
        }
    }
Ejemplo n.º 2
0
void BrowserOperation::menu()
{
    QMenu m(name,0);
    QMenu implbym(0);
    QMenu toolm(0);

    MenuFactory::createTitle(m, def->definition(FALSE, TRUE));
    m.addSeparator();

    if (!deletedp()) {
        if (!is_edited) {
            if (get_container(UmlClass) != 0)
                MenuFactory::addItem(m, QObject::tr("Up"), go_up,
                                     QObject::tr("to return to parent node"));

            QString nameOfNode = ((BrowserNode *) parent())->get_name();
            if(name == nameOfNode)
                MenuFactory::addItem(m, QObject::tr("Add constructor initializer"),
                                     add_constructor_initializer,
                                     QObject::tr("to edit the <i>operation</i>,"
                                                 "a double click with the left mouse button does the same thing"));



            MenuFactory::addItem(m, QObject::tr("Edit"), 0,
                                 QObject::tr("to edit the <i>operation</i>,"
                                             "a double click with the left mouse button does the same thing"));

            if (GenerationSettings::cpp_get_default_defs() &&
                    (strstr(def->get_cppdef(), "${body}") != 0))
                MenuFactory::addItem(m, QObject::tr("Edit C++ body"), 4,
                                     QObject::tr("to edit the <i>operation</i> and its C++ body"));

            if (GenerationSettings::java_get_default_defs() &&
                    (strstr(def->get_javadef(), "${body}") != 0))
                MenuFactory::addItem(m, QObject::tr("Edit Java body"), 5,
                                     QObject::tr("to edit the <i>operation</i> and its Java body"));

            if (GenerationSettings::php_get_default_defs() &&
                    (strstr(def->get_phpdef(), "${body}") != 0))
                MenuFactory::addItem(m, QObject::tr("Edit Php body"), 6,
                                     QObject::tr("to edit the <i>operation</i> and its Php body"));

            if (GenerationSettings::python_get_default_defs() &&
                    (strstr(def->get_pythondef(), "${body}") != 0))
                MenuFactory::addItem(m, QObject::tr("Edit Python body"), 7,
                                     QObject::tr("to edit the <i>operation</i> and its Python body"));

            if (((BrowserClass *) parent())->is_writable()) {
                if ((get_of == 0) && (set_of == 0))
                    MenuFactory::addItem(m, QObject::tr("Duplicate"), 1,
                                         QObject::tr("to copy the <i>operation</i> in a new one"));

                MenuFactory::addItem(m, QObject::tr("Add implementing activity"), 9,
                                     QObject::tr("to add a new <i>activity</i> implementing the <i>operation</i>"));
                MenuFactory::addItem(m, QObject::tr("Add implementing state"), 10,
                                     QObject::tr("to add a new <i>state</i> implementing the <i>operation</i>"));
            }

            m.addSeparator();
            MenuFactory::addItem(m, QObject::tr("Referenced by"), 8,
                                 QObject::tr("to know who reference the <i>operation</i>"));

            ImplBy.clear();
            BrowserActivity::compute_referenced_by(ImplBy, this);
            BrowserState::compute_referenced_by(ImplBy, this);

            if (! ImplBy.isEmpty()) {
                MenuFactory::insertItem(m, QObject::tr("Select implementing behavior"), &implbym,
                                        QObject::tr("to select a <i>state</i> or <i>activity</i> implementing the <i>operation</i>"));

                MenuFactory::createTitle(implbym, QObject::tr("Choose behavior"));
                implbym.addSeparator();

                int rank = 10000;

                foreach (BrowserNode * beh, ImplBy)
                    MenuFactory::addItem(implbym, beh->full_name(TRUE), rank);
            }

            if (!is_read_only && (edition_number == 0)) {
                m.addSeparator();
                MenuFactory::addItem(m, QObject::tr("Delete"), 2,
                                     QObject::tr("to delete the <i>operation</i>. \
                                                 Note that you can undelete it after"));
            }
        }

        mark_menu(m, QObject::tr("the operation"), 90);
        ProfiledStereotypes::menu(m, this, 99990);

        if ((edition_number == 0) &&
                Tool::menu_insert(&toolm, get_type(), 100)) {
            m.addSeparator();
            toolm.setTitle( QObject::tr("Tool"));
            m.addMenu(&toolm);
        }
    }