[Uml-devel] [Bug 120337] Custom operations in sequence diagrams become class operations

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


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=120337         
okellogg users sourceforge net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From okellogg users sourceforge net  2006-02-19 00:45 -------
SVN commit 511145 by okellogg:

SelectOpDlg::isClassOp(): New. Used by FloatingText::showOpDlg().
MessageWidget::loadFromXMI(): Remove backward compatibility crutch
 which stops us from supporting true custom ops.
BUG:120337


 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  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #511144:511145
 @ -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)
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/dialogs/selectopdlg.cpp #511144:511145
 @ -86,6 +86,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);
 @ -95,6 +99,7  @
         m_pOpLE -> setEnabled(true);
         m_pOpCB -> setEnabled(false);
     }
+    m_id = id;
 }
 
 void SelectOpDlg::setCustomOp(const QString &op) {
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/dialogs/selectopdlg.h #511144:511145
 @ -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  @
     QButtonGroup * 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);
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/floatingtext.cpp #511144:511145
 @ -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);
     }
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/messagewidget.cpp #511144:511145
 @ -827,22 +827,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