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

Oliver Kellogg okellogg at users.sourceforge.net
Sat Feb 11 22:52:22 UTC 2012


SVN commit 1279509 by okellogg:

loadUMLObjectsFromXMI(): Add comments clarifying which parts of code load
the native XMI format and which parts load foreign XMI formats.


 M  +22 -1     umldoc.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/umldoc.cpp #1279508:1279509
@@ -2054,6 +2054,9 @@
      */
     emit sigWriteToStatusBar( i18n("Loading UML elements...") );
 
+    // For Umbrello native XMI files, when called from loadFromXMI() we
+    // get here with Element.tagName() == "UML:Model" from the XMI input:
+    // <UML:Model name="UML Model">
     for (QDomNode node = element.firstChild(); !node.isNull();
             node = node.nextSibling()) {
         if (node.isComment()) {
@@ -2062,6 +2065,20 @@
         QDomElement tempElement = node.toElement();
         QString type = tempElement.tagName();
         if (tagEq(type, "Model")) {
+            // Handling of Umbrello native XMI files:
+            // We get here from a recursive call to loadUMLObjectsFromXMI()
+            // a few lines below, see
+            //       if (tagEq(type, "Namespace.ownedElement") ....
+            // Inside this Namespace.ownedElement envelope there are the
+            // four submodels:
+            // <UML:Model name="Logical View">
+            // <UML:Model name="Use Case View">
+            // <UML:Model name="Component View">
+            // <UML:Model name="Deployment View">
+            // These are ultimately loaded by UMLFolder::loadFromXMI()
+            // Furthermore, in Umbrello native XMI format this
+            // Namespace.ownedElement is the container of all stereotypes
+            // (<UML:Stereotype>).
             bool foundUmbrelloRootFolder = false;
             QString name = tempElement.attribute("name");
             for (int i = 0; i < Uml::ModelType::N_MODELTYPES; ++i) {
@@ -2076,7 +2093,6 @@
                 continue;
             }
         }
-        // From here on, it's support for stereotypes, pre 1.5.5 versions, and foreign files
         if (tagEq(type, "Namespace.ownedElement") ||
                 tagEq(type, "Namespace.contents") ||
                 tagEq(type, "Model")) {
@@ -2084,12 +2100,17 @@
             // are ownedElements anyway.
             // Therefore the <UML:Namespace.ownedElement> tag is of no
             // significance.
+            // The tagEq(type, "Namespace.contents") and tagEq(type, "Model")
+            // tests do not become true for Umbrello native files, only for
+            // some foreign XMI files.
             if ( !loadUMLObjectsFromXMI( tempElement ) ) {
                 uWarning() << "failed load on " << type;
                 return false;
             }
             continue;
         }
+        // From here on, it's support for stereotypes, pre 1.5.5 versions,
+        // and foreign files
         if (Model_Utils::isCommonXMIAttribute(type)) {
             continue;
         }




More information about the umbrello-devel mailing list