code: private static void incrementAttached() {
  
          attachCount += 1;
          if (attachCount == 1) {
              // Prevent events on TinyMCE popups from being cancelled by the PopupPanel containing the property dialog
  
              previewRegistration = Event.addNativePreviewHandler(new NativePreviewHandler() {
  
                  public void onPreviewNativeEvent(NativePreviewEvent pEvent) {
  
                      Event event = Event.as(pEvent.getNativeEvent());
                      EventTarget target = event.getEventTarget();
                      if (Element.is(target)) {
                          Element elem = Element.as(target);
                          while (elem != null) {
                              if (elem.getClassName().contains("mce-floatpanel")) {
                                  pEvent.consume();
                                  return;
                              }
                              elem = elem.getParentElement();
                          }
  
                      }
  
                  }
              });
  
          }
      }
docs: Increments the attach count, installs preview event handler when we go from 0 to 1.<p>