1.1 --- a/visualweb.designer.jsf/src/org/netbeans/modules/visualweb/designer/jsf/ui/AbstractJsfTopComponent.java Sun May 20 04:42:51 2007 +0000
1.2 +++ b/visualweb.designer.jsf/src/org/netbeans/modules/visualweb/designer/jsf/ui/AbstractJsfTopComponent.java Mon May 21 08:10:53 2007 +0000
1.3 @@ -56,6 +56,7 @@
1.4
1.5 import org.netbeans.modules.visualweb.designer.jsf.JsfForm;
1.6 import org.netbeans.modules.visualweb.designer.jsf.JsfSupportUtilities;
1.7 +import org.openide.util.WeakListeners;
1.8
1.9
1.10 /**
1.11 @@ -116,16 +117,18 @@
1.12 protected void designerActivated() {
1.13 // super.componentActivated();
1.14
1.15 - //Log.err.log("Component activated!");
1.16 - if (cblistener == null) {
1.17 - cblistener = new CBListener();
1.18 - }
1.19 -
1.20 +// //Log.err.log("Component activated!");
1.21 +// if (cblistener == null) {
1.22 +// cblistener = new CBListener();
1.23 +// }
1.24 + // #104330 Using weak listener.
1.25 + // XXX Is this efficient to recreate it each time the comp is activated?
1.26 + cblistener = new CBListener();
1.27 Clipboard c = getClipboard();
1.28 -
1.29 if (c instanceof ExClipboard) {
1.30 ExClipboard clip = (ExClipboard)c;
1.31 - clip.addClipboardListener(cblistener);
1.32 +// clip.addClipboardListener(cblistener);
1.33 + clip.addClipboardListener(WeakListeners.create(ClipboardListener.class, cblistener, clip));
1.34 }
1.35
1.36 // if (webform != null) {
1.37 @@ -152,14 +155,16 @@
1.38 // }
1.39 jsfForm.setModelActivated(false);
1.40
1.41 - // XXX why not super.componentDeactivated?
1.42 - //OutlineTopComp.getInstance().setCurrent(null);
1.43 - Clipboard c = getClipboard();
1.44 -
1.45 - if (c instanceof ExClipboard) {
1.46 - ExClipboard clip = (ExClipboard)c;
1.47 - clip.removeClipboardListener(cblistener);
1.48 - }
1.49 +// // XXX why not super.componentDeactivated?
1.50 +// //OutlineTopComp.getInstance().setCurrent(null);
1.51 +// Clipboard c = getClipboard();
1.52 +//
1.53 +// if (c instanceof ExClipboard) {
1.54 +// ExClipboard clip = (ExClipboard)c;
1.55 +// clip.removeClipboardListener(cblistener);
1.56 +// }
1.57 + // XXX Removing the weak listener.
1.58 + cblistener = null;
1.59
1.60 // if (webform != null) {
1.61 // deactivateActions();