// Create the UMLObject
    void CmdCreateUMLObject::redo()
    {
        // This object was removed from it's package when it was deleted
        // so add it back to it's package ( if it belonged to one )
        UMLPackage *pkg = m_obj->umlPackage();
        if (pkg) {
            // add this object to its parent package
            pkg->addObject(m_obj);

        } else {
            // object does not belong to any package
        }

        UMLDoc *doc = UMLApp::app()->document();
        doc->signalUMLObjectCreated(m_obj);
    }
Пример #2
0
bool validateObjType(Uml::Object_Type expected, UMLObject* &o, Uml::IDType id)
{
    if (o == NULL) {
        uDebug() << "Widget_Factory::validateObjType: creating new object of type "
                 << expected << endl;
        QString artificialName = "LOST_" + ID2STR(id);
        o = Object_Factory::createUMLObject(expected, artificialName, NULL, false);
        if (o == NULL)
            return false;
        o->setID(id);
        UMLPackage *parentPkg = o->umlPackage();
        parentPkg->addObject(o);
        return true;
    }
    Uml::Object_Type actual = o->baseType();
    if (actual == expected)
        return true;
    uError() << "validateObjType(" << o->name()
        << "): expected type " << expected << ", actual type "
        << actual << endl;
    return false;
}