svn commit: r12746 - trunk/src_new/org/argouml: kernel uml/diagram/ui

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2007-06-03 10:21:06-0700
New Revision: 12746

Modified:
   trunk/src_new/org/argouml/kernel/Project.java
   trunk/src_new/org/argouml/uml/diagram/ui/TabDiagram.java

Log:
Reduce the (cyclic) dependency from org.argouml.kernel to org.argouml.ui.targetmanager.

Modified: trunk/src_new/org/argouml/kernel/Project.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/kernel/Project.java?view=diff&rev=12746&p1=trunk/src_new/org/argouml/kernel/Project.java&p2=trunk/src_new/org/argouml/kernel/Project.java&r1=12745&r2=12746
==============================================================================
--- trunk/src_new/org/argouml/kernel/Project.java	(original)
+++ trunk/src_new/org/argouml/kernel/Project.java	2007-06-03 10:21:06-0700
@@ -439,7 +439,6 @@
                 }
             }
             activeDiagram = defaultDiagram;
-            TargetManager.getInstance().setTarget(defaultDiagram);
         }
 
         removeDiagram(d);

Modified: trunk/src_new/org/argouml/uml/diagram/ui/TabDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/TabDiagram.java?view=diff&rev=12746&p1=trunk/src_new/org/argouml/uml/diagram/ui/TabDiagram.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/TabDiagram.java&r1=12745&r2=12746
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/TabDiagram.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/TabDiagram.java	2007-06-03 10:21:06-0700
@@ -29,6 +29,8 @@
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
 import java.awt.event.MouseEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -44,6 +46,7 @@
 import org.apache.log4j.Logger;
 import org.argouml.application.api.Argo;
 import org.argouml.configuration.Configuration;
+import org.argouml.kernel.ProjectManager;
 import org.argouml.ui.AbstractArgoJPanel;
 import org.argouml.ui.ProjectBrowser;
 import org.argouml.ui.targetmanager.TargetEvent;
@@ -76,7 +79,8 @@
  */
 public class TabDiagram
     extends AbstractArgoJPanel
-    implements TabModelTarget, GraphSelectionListener, ModeChangeListener {
+    implements TabModelTarget, GraphSelectionListener, ModeChangeListener,
+    PropertyChangeListener {
 
     /**
      * Logger.
@@ -164,11 +168,7 @@
 
     /**
      * Sets the target of the tab. The target should allways be an instance of
-     * UMLDiagram
-     * @param t
-     * @deprecated As of ArgoUml version 0.13.5, the visibility of
-     * this method will change in the future, replaced by {@link
-     * org.argouml.ui.targetmanager.TargetManager}.
+     * UMLDiagram.
      * 
      * @param t the target
      */
@@ -183,6 +183,11 @@
         }
         UMLDiagram newTarget = (UMLDiagram) t;
 
+        if (target != null) {
+        	target.removePropertyChangeListener("remove", this);
+        }
+        newTarget.addPropertyChangeListener("remove", this);
+
         setToolBar(newTarget.getJToolBar());
         
         graph.removeGraphSelectionListener(this);
@@ -396,6 +401,14 @@
      * The UID.
      */
     private static final long serialVersionUID = -3305029387374936153L;
+
+	public void propertyChange(PropertyChangeEvent arg0) {
+		if ("remove".equals(arg0.getPropertyName())) {
+			Diagram diagram = ProjectManager.getManager()
+				.getCurrentProject().getActiveDiagram();
+			TargetManager.getInstance().setTarget(diagram);
+		}
+	}
 }
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.