[Uml-devel] KDE/kdesdk/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Fri Nov 24 18:38:41 UTC 2006


SVN commit 607458 by okellogg:

merge r606008:606867 from branches/KDE/3.5

 M  +11 -0     ChangeLog  
 M  +1 -1      VERSION  
 M  +1 -1      make-umbrello-release.sh  
 M  +16 -12    umbrello/associationwidget.cpp  
 M  +5 -0      umbrello/associationwidget.h  
 M  +12 -8     umbrello/codegenerators/sqlwriter.cpp  
 M  +1 -1      umbrello/model_utils.cpp  
 M  +1 -1      umbrello/model_utils.h  
 M  +1 -19     umbrello/object_factory.cpp  
 M  +2 -1      umbrello/umllistview.cpp  


--- trunk/KDE/kdesdk/umbrello/ChangeLog #607457:607458
@@ -1,3 +1,11 @@
+Version 1.5.6
+
+* Fixed save/reload of association widgets for collaboration diagrams
+  http://www.geeksoc.org/~jr/umbrello/uml-devel/9825.html
+  http://www.geeksoc.org/~jr/umbrello/uml-devel/9857.html
+* Bugs/wishes from http://bugs.kde.org:
+* Artifacts of a component diagram are wrongly placed in Deployment View folder (137564)
+
 Version 1.5.52
 
 * Fixed segfault in UMLClassifier::checkOperationSignature()
@@ -8,12 +16,15 @@
 * Fixed bugs in generated code of various code generators
 * Bugs/wishes from http://bugs.kde.org:
 * Shift + Left and Shift+Right causes SIGSEGV (136288)
+* Crashes on closing/opening files created with previous umbrello versions (136940)
+* Crash when opening saved document (136998)
 * Faulty behavior when a class inside of a package is modified (137497)
 
 Version 1.5.51
 
 * This is an interim release that fixes a serious regression in version 1.5.5
   which is detailed at http://bugs.kde.org/135749 (Crash when opening a document)
+* XMI file contains deleted associations (129859)
 * Accessor methods are private instead of public (85553)
 
 Version 1.5.5
--- trunk/KDE/kdesdk/umbrello/VERSION #607457:607458
@@ -1 +1 @@
-1.5.52
+1.5.6
--- trunk/KDE/kdesdk/umbrello/make-umbrello-release.sh #607457:607458
@@ -54,7 +54,7 @@
 make -f Makefile.cvs
 cd ..
 tarfile=${udir}.tar.bz2
-tar cfvj $tarfile --exclude=.svn $udir
+tar cfvj $tarfile --exclude=.svn --exclude=autom4te.cache $udir
 mv $tarfile $origdir/
 cd $origdir
 # rm -rf /tmp/kdesdk
--- trunk/KDE/kdesdk/umbrello/umbrello/associationwidget.cpp #607457:607458
@@ -116,7 +116,7 @@
     // Collaboration messages need a name label because it's that
     // which lets operator== distinguish them, which in turn
     // permits us to have more than one message between two objects.
-    if (getAssocType() == at_Coll_Message) {
+    if (isCollaboration()) {
         // Create a temporary name to bring on setName()
         int collabID = m_pView->generateCollaborationId();
         setName("m" + QString::number(collabID));
@@ -452,7 +452,7 @@
 
 void AssociationWidget::setMessageText(FloatingTextWidget *ft) {
     QString message;
-    if (getAssocType() == at_Coll_Message) {
+    if (isCollaboration()) {
         if (m_pObject != NULL) {
             message = getMulti(A) + ": " + getOperationText(m_pView);
         } else {
@@ -845,6 +845,11 @@
     return (widget == m_role[A].m_pWidget || widget == m_role[B].m_pWidget);
 }
 
+bool AssociationWidget::isCollaboration() {
+    Uml::Association_Type at = getAssocType();
+    return (at == at_Coll_Message || at == at_Coll_Message_Self);
+}
+
 Association_Type AssociationWidget::getAssocType() const {
     if (m_pObject == NULL || m_pObject->getBaseType() != ot_Association)
         return m_AssocType;
@@ -2268,7 +2273,7 @@
     if( menuType == ListPopupMenu::mt_Undefined ) {
         if (type == at_Anchor || onAssocClassLine(p))
             menuType = ListPopupMenu::mt_Anchor;
-        else if( type == at_Coll_Message )
+        else if (isCollaboration())
             menuType = ListPopupMenu::mt_Collaboration_Message;
         else if( AssocRules::allowRole( type ) )
             menuType = ListPopupMenu::mt_FullAssociation;
@@ -2318,7 +2323,7 @@
 
     //if it's a collaboration message we now just use the code in floatingtextwidget
     //this means there's some redundant code below but that's better than duplicated code
-    if (atype == at_Coll_Message && sel != ListPopupMenu::mt_Delete) {
+    if (isCollaboration() && sel != ListPopupMenu::mt_Delete) {
         m_pName->slotMenuSelection(sel);
         return;
     }
@@ -3259,8 +3264,7 @@
 }
 
 UMLClassifier *AssociationWidget::getOperationOwner() {
-    Association_Type atype = getAssocType();
-    Role_Type role = (atype == at_Coll_Message ? B : A);
+    Role_Type role = (isCollaboration() ? B : A);
     UMLObject *o = getWidget(role)->getUMLObject();
     if (o == NULL)
         return NULL;
@@ -3386,6 +3390,9 @@
     setWidget(pWidgetA, A);
     setWidget(pWidgetB, B);
 
+    QString type = qElement.attribute( "type", "-1" );
+    Uml::Association_Type aType = (Uml::Association_Type) type.toInt();
+
     QString id = qElement.attribute( "xmi.id", "-1" );
     bool oldStyleLoad = false;
     if (id == "-1") {
@@ -3396,8 +3403,6 @@
         // Create the UMLAssociation if both roles are UML objects;
         // else load the info locally.
 
-        QString type = qElement.attribute( "type", "-1" );
-        Uml::Association_Type aType = (Uml::Association_Type) type.toInt();
         if (UMLAssociation::assocTypeHasUMLRepresentation(aType)) {
             // lack of an association in our widget AND presence of
             // both uml objects for each role clearly identifies this
@@ -3478,13 +3483,11 @@
             return false;
         } else {
             const Uml::Object_Type ot = myObj->getBaseType();
-            if (ot == ot_Attribute || ot == ot_EntityAttribute) {
+            if (ot != ot_Association) {
                 setUMLObject(myObj);
-                QString type = qElement.attribute( "type", "-1" );
-                Uml::Association_Type aType = (Uml::Association_Type) type.toInt();
                 setAssocType(aType);
             } else {
-                UMLAssociation * myAssoc = (UMLAssociation*)myObj;
+                UMLAssociation * myAssoc = static_cast<UMLAssociation*>(myObj);
                 setUMLAssociation(myAssoc);
                 m_LinePath.setAssocType( myAssoc->getAssocType() );
             }
@@ -3579,6 +3582,7 @@
                 break;
 
             case Uml::tr_Coll_Message:
+            case Uml::tr_Coll_Message_Self:
                 m_pName = ft;
                 ft->setLink(this);
                 ft->setActivated();
--- trunk/KDE/kdesdk/umbrello/umbrello/associationwidget.h #607457:607458
@@ -247,6 +247,11 @@
     bool contains(UMLWidget* widget);
 
     /**
+     * Returns true if this AssociationWidget represents a collaboration message.
+     */
+    bool isCollaboration();
+
+    /**
      * Gets the association's type.
      *
      * @return  This AssociationWidget's Association_Type.
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/sqlwriter.cpp #607457:607458
@@ -86,14 +86,18 @@
     UMLAssociationList aggregations = c->getAggregations();
     if( forceSections() || !aggregations.isEmpty() ) {
         for(UMLAssociation* a = aggregations.first(); a; a = aggregations.next()) {
-            if( a->getObject(Uml::A)->getID() != c->getID() ) {
-
-                sql << m_indentation << "," << m_endl << m_indentation
-                << "CONSTRAINT " << a->getName() << " FOREIGN KEY ("
-                << a->getRoleName(Uml::B) << ") REFERENCES "
-                << a->getObject(Uml::A)->getName()
-                << " (" << a->getRoleName(Uml::A) << ")";
-            }
+            UMLObject *objA = a->getObject(Uml::A);
+            UMLObject *objB = a->getObject(Uml::B);
+            if (objA->getID() == c->getID() && objB->getID() != c->getID())
+                continue;
+            QString roleNameA = a->getRoleName(Uml::A);
+            QString roleNameB = a->getRoleName(Uml::B);
+            if (roleNameA.isEmpty() || roleNameB.isEmpty())
+                continue;
+            sql << m_indentation << "," << m_endl;
+            sql << m_indentation << "CONSTRAINT " << a->getName()
+                << " FOREIGN KEY (" << roleNameB << ") REFERENCES "
+                << objA->getName() << " (" << roleNameA << ")";
         }
     }
 
--- trunk/KDE/kdesdk/umbrello/umbrello/model_utils.cpp #607457:607458
@@ -100,7 +100,7 @@
     return NULL;
 }
 
-UMLObject* findUMLObject(UMLObjectList inList, QString name,
+UMLObject* findUMLObject(const UMLObjectList& inList, QString name,
                          Uml::Object_Type type /* = ot_UMLObject */,
                          UMLObject *currentObj /* = NULL */) {
     const bool caseSensitive = UMLApp::app()->activeLanguageIsCaseSensitive();
--- trunk/KDE/kdesdk/umbrello/umbrello/model_utils.h #607457:607458
@@ -65,7 +65,7 @@
  *                      object are searched before the global scope.
  * @return      Pointer to the UMLObject found, or NULL if not found.
  */
-UMLObject* findUMLObject( UMLObjectList inList, QString name,
+UMLObject* findUMLObject( const UMLObjectList& inList, QString name,
                           Uml::Object_Type type = Uml::ot_UMLObject,
                           UMLObject *currentObj = NULL);
 
--- trunk/KDE/kdesdk/umbrello/umbrello/object_factory.cpp #607457:607458
@@ -124,25 +124,7 @@
                            bool solicitNewName /* = true */) {
     UMLDoc *doc = UMLApp::app()->getDocument();
     if (parentPkg == NULL) {
-        Uml::Model_Type mt = Uml::mt_Logical;
-        switch (type) {
-            case Uml::ot_Actor:
-            case Uml::ot_UseCase:
-                mt = Uml::mt_UseCase;
-                break;
-            case Uml::ot_Component:
-                mt = Uml::mt_Component;
-                break;
-            case Uml::ot_Artifact:
-            case Uml::ot_Node:
-                mt = Uml::mt_Deployment;
-                break;
-            case Uml::ot_Entity:
-                mt = Uml::mt_EntityRelationship;
-                break;
-            default:
-                break;
-        }
+        Uml::Model_Type mt = Model_Utils::convert_OT_MT(type);
         kDebug() << "Object_Factory::createUMLObject(" << n << "): "
             << "parentPkg is not set, assuming Model_Type " << mt << endl;
         parentPkg = doc->getRootFolder(mt);
--- trunk/KDE/kdesdk/umbrello/umbrello/umllistview.cpp #607457:607458
@@ -1205,7 +1205,8 @@
             break;
         case Uml::lvt_Artifact:
         case Uml::lvt_Component_Diagram:
-            accept = (dstType == Uml::lvt_Component_Folder);
+            accept = (dstType == Uml::lvt_Component_Folder ||
+                      dstType == Uml::lvt_Component_View);
             break;
         case Uml::lvt_Node:
         case Uml::lvt_Deployment_Diagram:




More information about the umbrello-devel mailing list