private void replaceListener(
     Widget provider, TypedListener oldListener, SelectionListener newListener) {
   provider.removeListener(SWT.Selection, oldListener);
   provider.removeListener(SWT.DefaultSelection, oldListener);
   provider.addListener(SWT.Selection, new TypedListener(newListener));
   provider.addListener(SWT.DefaultSelection, new TypedListener(newListener));
 }
 private void handleWidgetDispose(Event event) {
   if (event.widget == widget) {
     widget.removeListener(SWT.Selection, getItemListener());
     widget.removeListener(SWT.Dispose, getItemListener());
     widget = null;
     disposeOldImages();
   }
 }
 private void replaceMenuListener(
     Widget provider, TypedListener oldListener, MenuListener newListener) {
   provider.removeListener(SWT.Show, oldListener);
   provider.addListener(SWT.Show, new TypedListener(newListener));
 }