svn commit: r17618 - trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java

Bob Tarling <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2009-12-09 18:24:13-0800
New Revision: 17618

Modified:
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java

Log:
Reduce setTarget to the code really required as the target never changes and will always be a UML element

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java?view=diff&pathrev=17618&r1=17617&r2=17618
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java	2009-12-09 18:24:13-0800
@@ -476,35 +476,16 @@
      * 
      * @param theNewTarget the new target
      */
-    protected void setTarget(Object theNewTarget) {
+    protected void setTarget(final Object theNewTarget) {
         assert (getTarget() == null);
-        assert (!(getTarget() instanceof Fig));
+        assert (Model.getFacade().isAUMLElement(theNewTarget));
         
-        theNewTarget = theNewTarget instanceof Fig
-            ? ((Fig) theNewTarget).getOwner() : theNewTarget;
-        if (Model.getFacade().isAUMLElement(theNewTarget)
-                || theNewTarget instanceof Diagram) {
-            if (Model.getFacade().isAUMLElement(listTarget)) {
-                Model.getPump().removeModelEventListener(this, listTarget,
-                        eventName);
-                // Allow listening to other elements:
-                removeOtherModelEventListeners(listTarget);
-            }
-
-            if (Model.getFacade().isAUMLElement(theNewTarget)) {
-                listTarget = theNewTarget;
-                Model.getPump().addModelEventListener(this, listTarget,
-                        eventName);
-                // Allow listening to other elements:
-                addOtherModelEventListeners(listTarget);
-
-                rebuildModelList();
+        listTarget = theNewTarget;
+        Model.getPump().addModelEventListener(this, listTarget, eventName);
+        // Allow listening to other elements:
+        addOtherModelEventListeners(listTarget);
 
-            } else {
-                listTarget = null;
-                removeAllElements();
-            }
-        }
+        rebuildModelList();
     }
 
     /**

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

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.