This is an automated email from the git hooks/post-receive script.

ben pushed a commit to branch master
in repository autocomplete.

commit 0cf27a3405238e55304f0185d5b4084f793ff278
Author: bobbylight <[email protected]>
Date:   Sat May 26 14:29:36 2012 +0000

    Remove PropertyChangeListener from UIManager when AutoCompletion is 
uninstalled to allow GC.
---
 src/org/fife/ui/autocomplete/AutoCompletion.java |   38 ++++++++++++++++------
 1 file changed, 28 insertions(+), 10 deletions(-)

diff --git a/src/org/fife/ui/autocomplete/AutoCompletion.java 
b/src/org/fife/ui/autocomplete/AutoCompletion.java
index 373256a..d044226 100644
--- a/src/org/fife/ui/autocomplete/AutoCompletion.java
+++ b/src/org/fife/ui/autocomplete/AutoCompletion.java
@@ -187,6 +187,12 @@ public class AutoCompletion {
        private AutoActivationListener autoActivationListener;
 
        /**
+        * Listens for LAF changes so the auto-complete windows automatically
+        * update themselves accordingly.
+        */
+       private LookAndFeelChangeListener lafListener;
+
+       /**
         * The key used in the input map for the AutoComplete action.
         */
        private static final String PARAM_TRIGGER_KEY   = "AutoComplete";
@@ -223,16 +229,7 @@ public class AutoCompletion {
                parentWindowListener = new ParentWindowListener();
                textComponentListener = new TextComponentListener();
                autoActivationListener = new AutoActivationListener();
-
-               // Automatically update LAF of popup windows on LookAndFeel 
changes
-               UIManager.addPropertyChangeListener(new 
PropertyChangeListener() {
-                       public void propertyChange(PropertyChangeEvent e) {
-                               String name = e.getPropertyName();
-                               if (name.equals("lookAndFeel")) {
-                                       updateUI();
-                               }
-                       }
-               });
+               lafListener = new LookAndFeelChangeListener();
 
        }
 
@@ -599,6 +596,9 @@ public class AutoCompletion {
                        autoActivationListener.addTo(this.textComponent);
                }
 
+               UIManager.addPropertyChangeListener(lafListener);
+               updateUI(); // In case there have been changes since we 
uninstalled
+
        }
 
 
@@ -1002,6 +1002,8 @@ public class AutoCompletion {
                                
autoActivationListener.removeFrom(textComponent);
                        }
 
+                       UIManager.removePropertyChangeListener(lafListener);
+
                        textComponent = null;
                        popupWindow = null;
 
@@ -1140,6 +1142,22 @@ public class AutoCompletion {
 
 
        /**
+        * Listens for LookAndFeel changes and updates the various popup windows
+        * involved in auto-completion accordingly.
+        */
+       private class LookAndFeelChangeListener implements 
PropertyChangeListener {
+
+               public void propertyChange(PropertyChangeEvent e) {
+                       String name = e.getPropertyName();
+                       if ("lookAndFeel".equals(name)) {
+                               updateUI();
+                       }
+               }
+
+       }
+
+
+       /**
         * Action that starts a parameterized completion, e.g. after '(' is
         * typed.
         *

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-java/autocomplete.git

_______________________________________________
pkg-java-commits mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

Reply via email to