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

Oliver Kellogg okellogg at users.sourceforge.net
Tue Nov 14 19:27:17 UTC 2006


SVN commit 604949 by okellogg:

UMLDoc::{determineNativity,isNativeXMIFile}: Remove.

 M  +0 -1      petaltree2uml.cpp  
 M  +15 -20    umldoc.cpp  
 M  +0 -23     umldoc.h  
 M  +11 -13    umlobject.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/petaltree2uml.cpp #604948:604949
@@ -579,7 +579,6 @@
         return false;
     }
     UMLDoc *umldoc = UMLApp::app()->getDocument();
-    umldoc->determineNativity("Certainly Not Native At All");
     umldoc->setCurrentRoot(Uml::mt_Logical);
     Import_Utils::assignUniqueIdOnCreation(false);
     PetalNode::NameValueList atts = logical_models->attributes();
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umldoc.cpp #604948:604949
@@ -1615,17 +1615,6 @@
     return true;
 }
 
-bool UMLDoc::determineNativity(const QString &xmiId) {
-    if (xmiId.isEmpty())
-        return false;
-    m_bNativeXMIFile = xmiId.contains( QRegExp("^\\d+$") );
-    return true;
-}
-
-bool UMLDoc::isNativeXMIFile() const {
-    return m_bNativeXMIFile;
-}
-
 bool UMLDoc::loadUMLObjectsFromXMI(QDomElement& element) {
     /* FIXME need a way to make status bar actually reflect
        how much of the file has been loaded rather than just
@@ -1637,7 +1626,6 @@
      */
     emit sigWriteToStatusBar( i18n("Loading UML elements...") );
 
-    bool bNativityIsDetermined = false;
     for (QDomNode node = element.firstChild(); !node.isNull();
             node = node.nextSibling()) {
         if (node.isComment())
@@ -1695,10 +1683,6 @@
             // soft error.
             continue;
         }
-        if (! bNativityIsDetermined) {
-            QString xmiId = tempElement.attribute("xmi.id", "");
-            bNativityIsDetermined = determineNativity(xmiId);
-        }
         Uml::Object_Type ot = pObject->getBaseType();
         // Set the parent root folder.
         UMLPackage *pkg = NULL;
@@ -1718,11 +1702,22 @@
         }
         pkg = pObject->getUMLPackage();
         if (ot == ot_Stereotype) {
-            UMLStereotype *s = static_cast<UMLStereotype*>(pObject);
-            if (findStereotype(s->getName()) != NULL)
-                delete s;
-            else
+            UMLStereotype *exist = findStereotype(pObject->getName());
+            if (exist) {
+                if (exist->getID() == pObject->getID()) {
+                    delete pObject;
+                } else {
+                    kdError() << "Stereotype " << pObject->getName()
+                        << "(id=" << ID2STR(pObject->getID())
+                        << ") already exists with id="
+                        << ID2STR(exist->getID()) << endl;
+                    UMLStereotype *s = static_cast<UMLStereotype*>(pObject);
+                    addStereotype(s);
+                }
+            } else {
+                UMLStereotype *s = static_cast<UMLStereotype*>(pObject);
                 addStereotype(s);
+            }
             continue;
         }
         pkg->addObject(pObject);
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umldoc.h #604948:604949
@@ -438,24 +438,6 @@
     bool validateXMIHeader(QDomNode& headerNode);
 
     /**
-     * Internally sets the m_bNativeXMIFile flag.
-     *
-     * @param xmiId             A sample xmi.id from the current file.
-     *                  It is asumed that the nativeness of the
-     *                  XMI file can be determined using only
-     *                  this sample xmi.id.
-     *                  For native Umbrello XMI files, the
-     *                  xmi.id's are composed of only digits.
-     * @return  True if nativity could be determied.
-     */
-    bool determineNativity(const QString &xmiId);
-
-    /**
-     * Return the m_bNativeXMIFile flag.
-     */
-    bool isNativeXMIFile() const;
-
-    /**
      * Loads all UML objects from XMI into the current UMLDoc.
      *
      * @return  True if operation successful.
@@ -859,11 +841,6 @@
     Uml::IDType m_nViewID;
 
     /**
-     * True when reading a native Umbrello XMI file.
-     */
-    bool m_bNativeXMIFile;
-
-    /**
      * True when type resolution pass has been executed.
      */
     bool m_bTypesAreResolved;
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlobject.cpp #604948:604949
@@ -419,21 +419,19 @@
             return true;
         }
     }
-    if (!pDoc->isNativeXMIFile() || !m_SecondaryId.contains(QRegExp("\\D"))) {
-        if (m_SecondaryFallback.isEmpty()) {
-            kdError() << "UMLObject::resolveRef(" << m_Name
-                      << "): cannot find type with id "
-                      << m_SecondaryId << endl;
-            return false;
-        }
+    if (m_SecondaryFallback.isEmpty()) {
+        kdError() << "UMLObject::resolveRef(" << m_Name
+                  << "): cannot find type with id "
+                  << m_SecondaryId << endl;
+        return false;
+    }
 #ifdef VERBOSE_DEBUGGING
-        kdDebug() << "UMLObject::resolveRef(" << m_Name 
-                  << "): could not resolve secondary ID " << m_SecondaryId
-                  << ", using secondary fallback " << m_SecondaryFallback
-                  << endl;
+    kdDebug() << "UMLObject::resolveRef(" << m_Name 
+              << "): could not resolve secondary ID " << m_SecondaryId
+              << ", using secondary fallback " << m_SecondaryFallback
+              << endl;
 #endif
-        m_SecondaryId = m_SecondaryFallback;
-    }
+    m_SecondaryId = m_SecondaryFallback;
     // Assume we're dealing with the older Umbrello format where
     // the type name was saved in the "type" attribute rather
     // than the xmi.id of the model object of the attribute type.




More information about the umbrello-devel mailing list