[Uml-devel] KDE/kdesdk/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sat Feb 18 15:48:01 UTC 2006


SVN commit 511146 by okellogg:

apply commit 511145 from branches/KDE/3.5

 M  +1 -0      ChangeLog  
 M  +5 -0      umbrello/dialogs/selectopdlg.cpp  
 M  +10 -0     umbrello/dialogs/selectopdlg.h  
 M  +23 -19    umbrello/floatingtext.cpp  
 M  +0 -16     umbrello/messagewidget.cpp  


--- trunk/KDE/kdesdk/umbrello/ChangeLog #511145:511146
@@ -7,6 +7,7 @@
 * Bugs/wishes from http://bugs.kde.org:
 * Import Rose model files (81364)
 * Default data types not added for old Java generator (115991)
+* Custom operations in sequence diagrams become class operations (120337)
 * Multiplicity labels positioned incorrectly when moving entities (120598)
 * Types of entity's attributes are displayed instead of their names (120742)
 * Unable to delete entity from entity list in "UML Model" frame (120750)
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/selectopdlg.cpp #511145:511146
@@ -89,6 +89,10 @@
         return m_pOpLE -> text();
 }
 
+bool SelectOpDlg::isClassOp() const {
+    return (m_id == OP);
+}
+
 void SelectOpDlg::slotSelected(int id) {
     if(id == OP) {
         m_pOpLE -> setEnabled(false);
@@ -98,6 +102,7 @@
         m_pOpLE -> setEnabled(true);
         m_pOpCB -> setEnabled(false);
     }
+    m_id = id;
 }
 
 void SelectOpDlg::setCustomOp(const QString &op) {
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/selectopdlg.h #511145:511146
@@ -64,6 +64,15 @@
     QString getOpText();
 
     /**
+     * Return whether the user selected a class operation
+     * or a custom operation.
+     *
+     * @return  True if user selected a class operation,
+     *          false if user selected a custom operation
+     */
+    bool isClassOp() const;
+
+    /**
      *  Returns the sequence number for the operation.
      *
      *  @return Returns the sequence number for the operation.
@@ -99,6 +108,7 @@
     Q3ButtonGroup * m_pOpBG, * m_pDocGB;
     QString m_Text;
     int m_nOpCount;
+    int m_id;  ///< takes on the value OP or CUSTOM according to what the user selected
     UMLView *m_pView;
 public slots:
     void slotSelected(int id);
--- trunk/KDE/kdesdk/umbrello/umbrello/floatingtext.cpp #511145:511146
@@ -304,26 +304,30 @@
     }
     seqNum = selectDlg.getSeqNumber();
     opText = selectDlg.getOpText();
-    Model_Utils::OpDescriptor od;
-    Model_Utils::Parse_Status st = Model_Utils::parseOperation(opText, od, c);
-    if (st == Model_Utils::PS_OK) {
-        UMLClassifierList selfAndAncestors = c->findSuperClassConcepts();
-        selfAndAncestors.prepend(c);
-        UMLOperation *op = NULL;
-        for (UMLClassifier *cl = selfAndAncestors.first(); cl; cl = selfAndAncestors.next()) {
-            op = cl->findOperation(od.m_name, od.m_args);
-            if (op != NULL)
-                break;
+    if (selectDlg.isClassOp()) {
+        Model_Utils::OpDescriptor od;
+        Model_Utils::Parse_Status st = Model_Utils::parseOperation(opText, od, c);
+        if (st == Model_Utils::PS_OK) {
+            UMLClassifierList selfAndAncestors = c->findSuperClassConcepts();
+            selfAndAncestors.prepend(c);
+            UMLOperation *op = NULL;
+            for (UMLClassifier *cl = selfAndAncestors.first(); cl; cl = selfAndAncestors.next()) {
+                op = cl->findOperation(od.m_name, od.m_args);
+                if (op != NULL)
+                    break;
+            }
+            if (op == NULL) {
+                // The op does not yet exist. Create a new one.
+                UMLObject *o = c->createOperation(od.m_name, NULL, &od.m_args);
+                op = static_cast<UMLOperation*>(o);
+            }
+            if (od.m_pReturnType)
+                op->setType(od.m_pReturnType);
+            m_pLink->setOperation(op);
+            opText = QString::null;
+        } else {
+            m_pLink->setOperation(NULL);
         }
-        if (op == NULL) {
-            // The op does not yet exist. Create a new one.
-            UMLObject *o = c->createOperation(od.m_name, NULL, &od.m_args);
-            op = static_cast<UMLOperation*>(o);
-        }
-        if (od.m_pReturnType)
-            op->setType(od.m_pReturnType);
-        m_pLink->setOperation(op);
-        opText = QString::null;
     } else {
         m_pLink->setOperation(NULL);
     }
--- trunk/KDE/kdesdk/umbrello/umbrello/messagewidget.cpp #511145:511146
@@ -832,22 +832,6 @@
             // If the UMLOperation is set, m_CustomOp isn't used anyway.
             // Just setting it empty for the sake of sanity.
             m_CustomOp = QString::null;
-        } else {
-            // Previous umbrello versions saved the operation text
-            // instead of the xmi.id of the operation.
-            // For backward compatibility, attempt to determine the
-            // m_pOperation from the operation text:
-            Model_Utils::OpDescriptor od;
-            Model_Utils::Parse_Status st = Model_Utils::parseOperation(m_CustomOp, od, c);
-            if (st == Model_Utils::PS_OK) {
-                bool isExistingOp = false;
-                UMLObject *o = c->createOperation(od.m_name, &isExistingOp, &od.m_args);
-                op = static_cast<UMLOperation*>(o);
-                if (od.m_pReturnType) {
-                    op->setType(od.m_pReturnType);
-                }
-                m_CustomOp = QString::null;
-            }
         }
     }
 




More information about the umbrello-devel mailing list