@Override
 public synchronized void dispose() {
   if (hasListeners()) {
     lastListenerRemoved();
   }
   super.dispose();
 }
  @Override
  protected void firstListenerAdded() {
    if (mySelectionListener == null) {
      mySelectionListener =
          new SelectionListener() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              /*
               * A RadioGroup issues two selection events when a new item is selected:
               * old->null and then null->new.
               *
               * We silently ignore events that switch to "null"...
               */
              if (e.item == null) return;
              handleSelectionChanged();
            }

            @Override
            public void widgetDefaultSelected(SelectionEvent e) {}
          };
    }
    myRadioGroup.addSelectionListener(mySelectionListener);
    super.firstListenerAdded();
  }
 @Override
 protected void lastListenerRemoved() {
   myRadioGroup.removeSelectionListener(mySelectionListener);
   super.lastListenerRemoved();
 }