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

Oliver Kellogg okellogg at users.sourceforge.net
Sun Mar 4 11:39:24 UTC 2012


SVN commit 1283454 by okellogg:

New function rootPackage() return the root folder of a given UMLObject

 M  +18 -0     model_utils.cpp  
 M  +2 -0      model_utils.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/model_utils.cpp #1283453:1283454
@@ -302,6 +302,24 @@
 }
 
 /**
+ * Get the root folder of the given UMLObject.
+ */
+UMLPackage* rootPackage(UMLObject* obj)
+{
+    if (obj == NULL)
+        return NULL;
+    UMLPackage* root = obj->umlPackage();
+    if (root == NULL) {
+        root = dynamic_cast<UMLPackage*>(obj);
+    } else {
+        while (root->umlPackage() != NULL) {
+            root = root->umlPackage();
+        }
+    }
+    return root;
+}
+
+/**
  * Add the given list of views to the tree view.
  * @param viewList   the list of views to add
  */
--- trunk/KDE/kdesdk/umbrello/umbrello/model_utils.h #1283453:1283454
@@ -48,6 +48,8 @@
                              UMLObject::ObjectType type = UMLObject::ot_UMLObject,
                              UMLObject *currentObj = 0);
 
+UMLPackage* rootPackage(UMLObject* obj);
+
 void treeViewAddViews(const UMLViewList& viewList);
 void treeViewChangeIcon(UMLObject* object, Icon_Utils::IconType to);
 void treeViewSetCurrentItem(UMLObject* object);




More information about the umbrello-devel mailing list