[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Wed Nov 8 22:31:45 UTC 2006


SVN commit 603434 by okellogg:

Improve pre-1.5.5 XMI loading of associations in the UseCase/Component/
Deployment/Entity-Relationship model. (These associations were 
wrongly put in the UMLFolder of the Logical View.)


 M  +14 -2     association.cpp  
 M  +3 -1      umldoc.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/association.cpp #603433:603434
@@ -213,9 +213,15 @@
             obj[r] = doc->findObjectById(STR2ID(roleIdStr));
             Uml::Role_Type role = (Uml::Role_Type)r;
             if (obj[r] == NULL) {
-                getUMLRole(role)->setSecondaryId(roleIdStr);  // defer to resolveRef()
+                m_pRole[role]->setSecondaryId(roleIdStr);  // defer to resolveRef()
             } else {
-                getUMLRole(role)->setObject(obj[r]);
+                m_pRole[role]->setObject(obj[r]);
+                if (m_pUMLPackage == NULL) {
+                    Uml::Model_Type mt = Model_Utils::convert_OT_MT(obj[r]->getBaseType());
+                    m_pUMLPackage = doc->getRootFolder(mt);
+                    kdDebug() << "UMLAssociation::load(assoctype " << m_AssocType
+                        << "): setting model type " << mt << endl;
+                }
             }
         }
         if (obj[A] == NULL || obj[B] == NULL) {
@@ -318,6 +324,12 @@
         if (! getUMLRole(B)->loadFromXMI(tempElement))
             return false;
 
+        if (m_pUMLPackage == NULL) {
+            Uml::Model_Type mt = Model_Utils::convert_OT_MT(getObject(B)->getBaseType());
+            m_pUMLPackage = doc->getRootFolder(mt);
+            kdDebug() << "UMLAssociation::load: setting model type " << mt << endl;
+        }
+
         // setting the association type:
         //
         // In the old days, we could just record this on the association,
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umldoc.cpp #603433:603434
@@ -1706,7 +1706,8 @@
             pkg = m_datatypeRoot;
         } else {
             Uml::Model_Type guess = Model_Utils::guessContainer(pObject);
-            pkg = m_root[guess];
+            if (guess != Uml::N_MODELTYPES)
+                pkg = m_root[guess];
         }
         pObject->setUMLPackage(pkg);
 
@@ -1715,6 +1716,7 @@
             delete pObject;
             return false;
         }
+        pkg = pObject->getUMLPackage();
         if (ot == ot_Stereotype) {
             UMLStereotype *s = static_cast<UMLStereotype*>(pObject);
             if (findStereotype(s->getName()) != NULL)




More information about the umbrello-devel mailing list