svn commit: r19551 - trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ModelEventPumpEUMLImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2011-06-13 11:07:09-0700
New Revision: 19551

Modified:
   trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ModelEventPumpEUMLImpl.java

Log:
Impove unregister of listeners - contributed by Laurent Braud

Modified: trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ModelEventPumpEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ModelEventPumpEUMLImpl.java?view=diff&pathrev=19551&r1=19550&r2=19551
==============================================================================
--- trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ModelEventPumpEUMLImpl.java	(original)
+++ trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/ModelEventPumpEUMLImpl.java	2011-06-13 11:07:09-0700
@@ -10,6 +10,7 @@
  *    Bogdan Pistol - initial implementation
  *    Thomas Neustupny
  *    Bob Tarling
+ *    Laurent Braud
  *******************************************************************************/
 package org.argouml.model.euml;
 
@@ -230,6 +231,7 @@
             boolean found = false;
             if (list == null) {
                 list = new ArrayList<Listener>();
+                register.put(notifier, list);
             } else {
                 for (Listener l : list) {
                     if (l.getListener() == listener) {
@@ -241,7 +243,6 @@
             }
             if (!found) {
                 list.add(new Listener(listener, propertyNames));
-                register.put(notifier, list);
             }
         }
     }
@@ -296,12 +297,18 @@
                 if (l.getListener() == listener) {
                     if (propertyNames != null) {
                         l.removeProperties(propertyNames);
+                        if(l.getProperties().isEmpty()){
+                            iter.remove();
+                        }
                     } else {
                         iter.remove();
                     }
                     break;
                 }
             }
+            if(list.isEmpty()){
+                register.remove(notifier);
+            }
         }
     }

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

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.