svn commit: r18758 - trunk/src: argouml-app/src/org/argouml/notation/providers/uml argouml-core-model-mdr/src/org/argouml/model/mdr

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2010-09-17 05:08:51-0700
New Revision: 18758

Modified:
   trunk/src/argouml-app/src/org/argouml/notation/providers/uml/StateBodyNotationUml.java
   trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CommonBehaviorHelperMDRImpl.java

Log:
Improvement on commit 18739 for issue 6145: CallAction outside the Model in XMI.
This solves the problem in the MDR subsystem - so it works in all cases where the setScript() function is used.


Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/StateBodyNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/StateBodyNotationUml.java?view=diff&pathrev=18758&r1=18757&r2=18758
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/StateBodyNotationUml.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/StateBodyNotationUml.java	2010-09-17 05:08:51-0700
@@ -463,9 +463,6 @@
             if (body.equals(s)) {
                 return;
             }
-            /* Throw away the old actionExpression (see issue 6145):  */
-            Model.getCommonBehaviorHelper().setScript(old, null);
-            Model.getUmlFactory().delete(ae);
         }
         ae = Model.getDataTypesFactory().createActionExpression(language, s);
         Model.getCommonBehaviorHelper().setScript(old, ae);

Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CommonBehaviorHelperMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CommonBehaviorHelperMDRImpl.java?view=diff&pathrev=18758&r1=18757&r2=18758
==============================================================================
--- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CommonBehaviorHelperMDRImpl.java	(original)
+++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CommonBehaviorHelperMDRImpl.java	2010-09-17 05:08:51-0700
@@ -458,7 +458,19 @@
     public void setScript(Object handle, Object expr) {
         if (handle instanceof Action
                 && (expr == null || expr instanceof ActionExpression)) {
-            ((Action) handle).setScript((ActionExpression) expr);
+            Action a = (Action) handle;
+            ActionExpression ae =a.getScript();
+            if (ae == (ActionExpression) expr) {
+                return;
+            }
+            if (ae != null) {
+                /* Throw away the old actionExpression (see issue 6145):  */
+                a.setScript(null);
+                modelImpl.getUmlFactory().delete(ae);
+            }
+            if (expr != null) {
+                a.setScript((ActionExpression) expr);
+            }
             return;
         }
         throw new IllegalArgumentException("handle: " + handle + " or expr: "

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2661260

To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.