Bug 120337: Custom operations in sequence diagrams become class operations (normal)
Opened:2006-01-17 19:41
Product:umbrello
Component:general
Version:unspecified
Status:RESOLVED
Platform:Debian testing
Resolution:FIXED
Reporter:Pekka Vuorela
Assigned to:Umbrello Development Group

Version:            (using KDE KDE 3.5.0)
Installed from:    Debian testing/unstable Packages
OS:                Linux

Making a sequence diagram and selecting "custom operation" results in adding a new method to the associated class. Also the selected operation becomes "class operation". Therefore it is impossible to have a real custom operation in sequence diagrams.

Further, if I delete the new method from the class, save & open the project, the method name is replaced by a random number (e.g. 563()).


------- Additional Comment #1 From Oliver Kellogg 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
 at  at  -7,6 +7,7  at  at
 * 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
 at  at  -86,6 +86,10  at  at
         return m_pOpLE -> text();
 }
 
+bool SelectOpDlg::isClassOp() const {
+    return (m_id == OP);
+}
+
 void SelectOpDlg::slotSelected(int id) {
     if(id == OP) {
         m_pOpLE -> setEnabled(false);
 at  at  -95,6 +99,7  at  at
         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
 at  at  -64,6 +64,15  at  at
     QString getOpText();
 
     /**
+     * Return whether the user selected a class operation
+     * or a custom operation.
+     *
+     *  at 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.
      *
      *   at return Returns the sequence number for the operation.
 at  at  -99,6 +108,7  at  at
     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
 at  at  -304,26 +304,30  at  at
     }
     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
 at  at  -827,22 +827,6  at  at
             // 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;
-            }
         }
     }
 


Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments:


View Bug Activity   |   Format For Printing


Attachment Type Modified Status Actions
Create a New Attachment (proposed patch, testcase, etc.) View All


Actions: Query | Reports Search:   New Account | Log In