svn commit: r17149 - trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CollaborationsHelperMDRImpl.java

Bob Tarling <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2009-06-22 16:07:56-0700
New Revision: 17149

Modified:
   trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CollaborationsHelperMDRImpl.java

Log:
If we add a message to an interaction then remove it from any other interaction it is already applied to.

Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CollaborationsHelperMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CollaborationsHelperMDRImpl.java?view=diff&pathrev=17149&r1=17148&r2=17149
==============================================================================
--- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CollaborationsHelperMDRImpl.java	(original)
+++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/CollaborationsHelperMDRImpl.java	2009-06-22 16:07:56-0700
@@ -845,7 +845,14 @@
 
     public void addMessage(Object handle, Object elem) {
         if (handle instanceof Interaction && elem instanceof Message) {
-            ((Interaction) handle).getMessage().add((Message) elem);
+            final Message message = (Message) elem;
+            final Interaction interaction = (Interaction) handle;
+            final Interaction oldInteraction = message.getInteraction();
+            
+            if (oldInteraction != null) {
+                oldInteraction.getMessage().remove(message);
+            }
+            interaction.getMessage().add(message);
             return;
         }
         if (handle instanceof AssociationRole && elem instanceof Message) {

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

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.