[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Tue Aug 24 16:50:22 UTC 2004


CVS commit by okellogg: 

resolveType(): Avoid "Enter name:" popup when loading version 1.3 and older
 XMI files.


  M +25 -6     attribute.cpp   1.15


--- kdesdk/umbrello/umbrello/attribute.cpp  #1.14:1.15
@@ -137,10 +137,29 @@ bool UMLAttribute::resolveType() {
                         // attribute type name was saved in the "type" rather than the
                         // xmi.id of the model object of the attribute type.
+
+                        // Hack: Replace "::" because UMLDoc::findUMLObject() is
+                        // sensitive to "::".
+                        m_TypeName.replace( "::", "." );
+                        typeObj = pDoc->findUMLObject( m_TypeName );
+                        if (typeObj) {
+                                m_pType = dynamic_cast<UMLClassifier*>(typeObj);
+                                if (m_pType == NULL) {
+                                        kdError() << "UMLAttribute::resolveType(" << m_Name
+                                                  << "): type with id " << m_TypeName
+                                                  << " is not a UMLClassifier" << endl;
+                                        return false;
+                                }
+                                m_TypeName = "";
+                        } else {
                         kdDebug() << "UMLAttribute::resolveType: Creating new type for "
                                   << m_TypeName << endl;
-                        if (m_TypeName.contains( QRegExp("\\W") ))
+                                //FIXME: This is very C++ specific - we rely on
+                                //       some '*' or '&' to decide it's a ref type.
+                                if ( m_TypeName.contains('*') ||
+                                     m_TypeName.contains('&') )
                                 typeObj = pDoc->createUMLObject(ot_Datatype, m_TypeName);
                         else
                                 typeObj = pDoc->createUMLObject(ot_Class, m_TypeName);
+                        }
                 } else {
                         // It's not an Umbrello format.






More information about the umbrello-devel mailing list