[Uml-devel] branches/work/soc-umbrello/umbrello

Andi Fischer andi.fischer at hispeed.ch
Wed May 2 19:44:03 UTC 2012


SVN commit 1292615 by fischer:

Differences to trunk reduced.

 M  +2 -1      folder.h  
 M  +2 -2      listpopupmenu.cpp  
 M  +32 -2     umldoc.cpp  
 U             umlscene.cpp  


--- branches/work/soc-umbrello/umbrello/folder.h #1292614:1292615
@@ -28,8 +28,9 @@
  * @short Non-graphical management of objects and diagrams of a Folder
  * @author Oliver Kellogg
  * Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
+ *
+ * TODO: This whole class needs a relook regarding view/scene.
  */
-//[PORT] This whole class needs a relook regd scene/view.
 class UMLFolder : public UMLPackage
 {
     Q_OBJECT
--- branches/work/soc-umbrello/umbrello/listpopupmenu.cpp #1292614:1292615
@@ -384,8 +384,8 @@
         {
             //Used for sequence diagram and collaboration diagram widgets
             insertSubMenuColor( object->useFillColor() );
-            // [PORT]
-            if( object->umlScene() && object->umlScene()->type() == Uml::DiagramType::Sequence ) {
+            if (object->umlScene() &&
+                object->umlScene()->type() == Uml::DiagramType::Sequence) {
                 addSeparator();
                 MenuType tabUp = mt_Up;
                 insert(mt_Up, Icon_Utils::SmallIcon(Icon_Utils::it_Arrow_Up), i18n("Move Up"));
--- branches/work/soc-umbrello/umbrello/umldoc.cpp #1292614:1292615
@@ -327,7 +327,7 @@
 
     UMLListView *listView = UMLApp::app()->listView();
     if (listView) {
-        listView->clean();  //:TODO: ->init();
+        listView->clean();
         // store old setting - for restore of last setting
         bool m_bLoading_old = m_bLoading;
         m_bLoading = true; // This is to prevent document becoming modified.
@@ -349,7 +349,6 @@
         createDatatypeFolder();
         // this creates to much items only Logical View should be created
         listView->init();
-        // listView->theDatatypeFolder()->setUMLObject(m_datatypeRoot);
         /* Remove any stereotypes.
         if (m_stereoList.count() > 0) {
             UMLStereotype *s;
@@ -1524,6 +1523,10 @@
  */
 void UMLDoc::removeUMLObject(UMLObject* umlobject)
 {
+    if (umlobject == NULL) {
+        uError() << "called with NULL parameter";
+        return;
+    }
     UMLApp::app()->docWindow()->updateDocumentation(true);
     UMLObject::ObjectType type = umlobject->baseType();
 
@@ -1568,6 +1571,33 @@
         } else {
             UMLPackage* pkg = umlobject->umlPackage();
             if (pkg) {
+                // Remove associations that this object may participate in.
+                UMLCanvasObject *c = dynamic_cast<UMLCanvasObject*>(umlobject);
+                if (c) {
+                    // In the current implementation, all associations live in the
+                    // root folder.
+                    UMLPackage* rootPkg = Model_Utils::rootPackage(c);
+                    if (rootPkg == NULL) {
+                        uError() << umlobject->name() << ": root package is not set !";
+                        return;
+                    }
+                    UMLObjectList rootObjects = rootPkg->containedObjects();
+                    // Store the associations to remove in a buffer because we
+                    // should not remove elements from m_objectList while it is
+                    // being iterated over.
+                    UMLAssociationList assocsToRemove;
+                    foreach (UMLObject *obj , rootObjects) {
+                        if (obj->baseType() == UMLObject::ot_Association) {
+                            UMLAssociation *assoc = static_cast<UMLAssociation*>(obj);
+                            if (c->hasAssociation(assoc)) {
+                                assocsToRemove.append(assoc);
+                            }
+                        }
+                    }
+                    foreach (UMLAssociation *a, assocsToRemove) {
+                        removeAssociation(a, false);
+                    }
+                }
                 pkg->removeObject(umlobject);
             } else {
                 uError() << umlobject->name() << ": parent package is not set !";




More information about the umbrello-devel mailing list