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

Oliver Kellogg okellogg at users.sourceforge.net
Wed Apr 18 04:11:08 UTC 2007


SVN commit 655250 by okellogg:

insertMethod(): Call UMLClassifier::checkOperationSignature() on the new op.
 If it exists then copy the properties of the new op to the existing op.
All code: Do not call DocWindow::showDocumentation(), it spoils the UMLObject::m_Doc.
BUG:144346


 M  +1 -0      ChangeLog  
 M  +29 -6     umbrello/codeimport/import_utils.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #655249:655250
@@ -30,6 +30,7 @@
 * Crash on changing multiplicity in an association in ERD (143909)
 * Class diagram in folder not loaded correctly from xmi (144119)
 * Sequence diagram crashes during message inserting (144293)
+* No synchronisation of comments when round-tripping (144346)
 
 Version 1.5.61
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/import_utils.cpp #655249:655250
@@ -244,7 +244,7 @@
     QString strippedComment = formatComment(comment);
     if (! strippedComment.isEmpty()) {
         o->setDoc(strippedComment);
-        UMLApp::app()->getDocWindow()->showDocumentation(o, true);
+        //UMLApp::app()->getDocWindow()->showDocumentation(o, true);
     }
     if (!stereotype.isEmpty()) {
         o->setStereotype(stereotype);
@@ -304,7 +304,7 @@
     QString strippedComment = formatComment(comment);
     if (! strippedComment.isEmpty()) {
         attr->setDoc(strippedComment);
-        UMLApp::app()->getDocWindow()->showDocumentation(attr, true);
+        //UMLApp::app()->getDocWindow()->showDocumentation(attr, true);
     }
 
     UMLApp::app()->getDocument()->setModified(true);
@@ -362,14 +362,37 @@
     if (isConstructor)
         op->setStereotype("constructor");
 
-    klass->addOperation(op);
-    //umldoc->signalUMLObjectCreated(op);
     QString strippedComment = formatComment(comment);
     if (! strippedComment.isEmpty()) {
         op->setDoc(strippedComment);
-        UMLApp::app()->getDocWindow()->showDocumentation(op, true);
     }
-    //setModified(true);
+
+    UMLAttributeList params = op->getParmList();
+    UMLOperation *exist = klass->checkOperationSignature(op->getName(), params);
+    if (exist) {
+        // copy contents to existing operation
+        exist->setVisibility(scope);
+        exist->setStatic(isStatic);
+        exist->setAbstract(isAbstract);
+        if (! strippedComment.isEmpty())
+            exist->setDoc(strippedComment);
+        UMLAttributeList exParams = exist->getParmList();
+        UMLAttribute *param, *exParam = exParams.first();
+        for (UMLAttributeListIt it(params); (param = it.current()) != NULL;
+                                            ++it, exParam = exParams.next()) {
+            exParam->setName(param->getName());
+            exParam->setVisibility(param->getVisibility());
+            exParam->setStatic(param->getStatic());
+            exParam->setAbstract(param->getAbstract());
+            exParam->setDoc(param->getDoc());
+            exParam->setInitialValue(param->getInitialValue());
+            exParam->setParmKind(param->getParmKind());
+        }
+        // delete temporary UMLOperation
+        delete op;
+    } else {
+        klass->addOperation(op);
+    }
 }
 
 UMLAttribute* addMethodParameter(UMLOperation *method,




More information about the umbrello-devel mailing list