[hg] main-silver: #224856: NodeRegistry uses weak lookup listeners

  • From: Jaroslav Havlin < >
  • To:
  • Subject: [hg] main-silver: #224856: NodeRegistry uses weak lookup listeners
  • Date: Thu, 17 Jan 2013 11:59:12 -0800

changeset 32bc4f6809be in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/32bc4f6809be
description:
        #224856: NodeRegistry uses weak lookup listeners

diffstat:

 db/src/org/netbeans/modules/db/explorer/node/NodeRegistry.java |  10 
+++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (38 lines):

diff --git a/db/src/org/netbeans/modules/db/explorer/node/NodeRegistry.java 
b/db/src/org/netbeans/modules/db/explorer/node/NodeRegistry.java
--- a/db/src/org/netbeans/modules/db/explorer/node/NodeRegistry.java
+++ b/db/src/org/netbeans/modules/db/explorer/node/NodeRegistry.java
@@ -64,6 +64,7 @@
 import org.openide.util.LookupEvent;
 import org.openide.util.LookupListener;
 import org.openide.util.NbBundle;
+import org.openide.util.WeakListeners;
 import org.openide.util.lookup.Lookups;
 
 /**
@@ -87,6 +88,7 @@
     private final List<NodeProvider> providers = new 
CopyOnWriteArrayList<NodeProvider>();
 
     private Lookup.Result lookupResult;
+    private LookupListener lookupListener;
     
     /** 
      * Create an instance of NodeRegistry.
@@ -117,13 +119,15 @@
         initProviders(dataLookup);
         
         // listen for changes and re-init the providers when the lookup 
changes
-        lookupResult.addLookupListener(
-            new LookupListener() {
+        
lookupResult.addLookupListener(WeakListeners.create(LookupListener.class,
+            lookupListener = new LookupListener() {
+                @Override
                 public void resultChanged(LookupEvent ev) {
                     initProviders(dataLookup);
                     changeSupport.fireChange();
                 }
-            }
+            },
+            lookupResult)
         );
     }
     

[hg] main-silver: #224856: NodeRegistry uses weak lookup listeners

Jaroslav Havlin 01/17/2013

Project Features

About this Project

DB was started in November 2009, is owned by Antonin Nebuzelsky, and has 113 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close