changeset 13719:8e6b47ee2f25

IGV: throw graph reference away when GraphNode component is closed
author Bernhard Urban <bernhard.urban@jku.at>
date Tue, 21 Jan 2014 00:20:33 +0200
parents 34b07168b505
children 4281521dc39a
files src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java	Mon Jan 20 20:17:05 2014 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java	Tue Jan 21 00:20:33 2014 +0200
@@ -38,6 +38,9 @@
 import org.openide.actions.OpenAction;
 import org.openide.nodes.AbstractNode;
 import org.openide.nodes.Children;
+import org.openide.nodes.NodeAdapter;
+import org.openide.nodes.NodeEvent;
+import org.openide.nodes.NodeMemberEvent;
 import org.openide.nodes.Sheet;
 import org.openide.util.ImageUtilities;
 import org.openide.util.Lookup;
@@ -49,7 +52,7 @@
  * @author Thomas Wuerthinger
  */
 public class GraphNode extends AbstractNode {
-    private final InputGraph graph;
+    private InputGraph graph;
 
     /** Creates a new instance of GraphNode */
     public GraphNode(InputGraph graph) {
@@ -77,6 +80,13 @@
 
         // Action for cloning to the current graph
         content.add(new GraphCloneCookie(viewer, graph));
+        
+        this.addNodeListener(new NodeAdapter() {
+            @Override
+            public void childrenRemoved(NodeMemberEvent ev) {
+                GraphNode.this.graph = null;
+            }
+        });
     }
 
     @Override