[Uml-devel] branches/work/isi-umbrello/umbrello/umbrello

Florence Mattler florence.mattler at libertysurf.fr
Thu Mar 22 20:41:33 UTC 2007


SVN commit 645532 by mattler:

allow an activity transition between an object node/a signal and a final/end activity


 M  +20 -8     assocrules.cpp  


--- branches/work/isi-umbrello/umbrello/umbrello/assocrules.cpp #645531:645532
@@ -20,6 +20,7 @@
 #include "associationwidget.h"
 #include "statewidget.h"
 #include "activitywidget.h"
+#include "signalwidget.h"
 #include "forkjoinwidget.h"
 
 using namespace Uml;
@@ -188,11 +189,22 @@
     case at_Activity:
     case at_Exception:
         {
+           
             ActivityWidget *actA = dynamic_cast<ActivityWidget*>(widgetA);
             ActivityWidget *actB = dynamic_cast<ActivityWidget*>(widgetB);
+           
+            bool isSignal = false;
+            bool isObjectNode = false;
+       
+            if (widgetTypeA == wt_Signal)
+                isSignal = true;
+            else if (widgetTypeA == wt_ObjectNode)
+                isObjectNode = true;
+
             // no transitions to initial activity allowed
-            if (actB && actB->getActivityType() == ActivityWidget::Initial)
+            if (actB && actB->getActivityType() == ActivityWidget::Initial) {
                 return false;
+            }
             // Fork_DEPRECATED here means "not applicable".
             ActivityWidget::ActivityType actTypeA = ActivityWidget::Fork_DEPRECATED;
             if (actA)
@@ -200,11 +212,11 @@
             ActivityWidget::ActivityType actTypeB = ActivityWidget::Fork_DEPRECATED;
             if (actB)
                 actTypeB = actB->getActivityType();
-            // only from a normal, branch or fork activity to the end
-            if (actTypeB == ActivityWidget::End &&
+            // only from a signalwidget a objectnode widget, a normal activity, branch or fork activity, to the end
+            if ((actTypeB == ActivityWidget::End || actTypeB == ActivityWidget::Final) &&
                 actTypeA != ActivityWidget::Normal &&
                 actTypeA != ActivityWidget::Branch &&
-                dynamic_cast<ForkJoinWidget*>(widgetA) == NULL) {
+                dynamic_cast<ForkJoinWidget*>(widgetA) == NULL && !isSignal &&!isObjectNode) {
                 return false;
             }
             // only Forks and Branches can have more than one "outgoing" transition
@@ -353,15 +365,15 @@
     { at_State,         wt_State,       wt_ForkJoin,    true,   false,  true,   true  },
     { at_Activity,      wt_Signal,      wt_Activity,    true,   false,  true,   true  },
     { at_Activity,      wt_Activity,    wt_Signal,      true,   false,  true,   true  },
-    { at_Activity,      wt_ObjectNode, wt_Activity,    true,   false,  true,   true  },
-    { at_Activity,      wt_Activity,    wt_ObjectNode, true,   false,  true,   true  },
+    { at_Activity,      wt_ObjectNode,  wt_Activity,    true,   false,  true,   true  },
+    { at_Activity,      wt_Activity,    wt_ObjectNode,  true,   false,  true,   true  },
     { at_Activity,      wt_Activity,    wt_Activity,    true,   false,  true,   true  },
     { at_Activity,      wt_ForkJoin,    wt_Activity,    true,   false,  true,   true  },
     { at_Activity,      wt_Activity,    wt_ForkJoin,    true,   false,  true,   true  },
     { at_Activity,      wt_Signal,      wt_ForkJoin,    true,   false,  true,   true  },
     { at_Activity,      wt_ForkJoin,    wt_Signal,      true,   false,  true,   true  },
-    { at_Activity,      wt_ForkJoin,    wt_ObjectNode, true,   false,  true,   true  },
-    { at_Activity,      wt_ObjectNode, wt_ForkJoin,    true,   false,  true,   true  },
+    { at_Activity,      wt_ForkJoin,    wt_ObjectNode,  true,   false,  true,   true  },
+    { at_Activity,      wt_ObjectNode,  wt_ForkJoin,    true,   false,  true,   true  },
     { at_Anchor,        wt_Class,       wt_Note,        false,  false,  false,  false },
     { at_Anchor,        wt_Package,     wt_Note,        false,  false,  false,  false },
     { at_Anchor,        wt_Interface,   wt_Note,        false,  false,  false,  false },




More information about the umbrello-devel mailing list