private Window updateMaskAndAlpha(Window window) {
    if (window == null) return window;

    final WindowManagerEx wndManager = getWndManager();
    if (wndManager == null) return window;

    if (!wndManager.isAlphaModeEnabled(window)) return window;

    if (myAlpha != myLastAlpha) {
      wndManager.setAlphaModeRatio(window, myAlpha);
      myLastAlpha = myAlpha;
    }

    if (myMaskProvider != null) {
      final Dimension size = window.getSize();
      Shape mask = myMaskProvider.getMask(size);
      wndManager.setWindowMask(window, mask);
    }

    WindowManagerEx.WindowShadowMode mode =
        myShadowed
            ? WindowManagerEx.WindowShadowMode.NORMAL
            : WindowManagerEx.WindowShadowMode.DISABLED;
    WindowManagerEx.getInstanceEx().setWindowShadow(window, mode);

    return window;
  }
 @Override
 public Dimension getSize() {
   if (myPopup != null) {
     final Window popupWindow = SwingUtilities.windowForComponent(myContent);
     return popupWindow.getSize();
   } else {
     return myForcedSize;
   }
 }
 public void setUiVisible(final boolean visible) {
   if (myPopup != null) {
     if (visible) {
       myPopup.show();
       final Window window = getPopupWindow();
       if (window != null && myRestoreWindowSize != null) {
         window.setSize(myRestoreWindowSize);
         myRestoreWindowSize = null;
       }
     } else {
       final Window window = getPopupWindow();
       if (window != null) {
         myRestoreWindowSize = window.getSize();
         window.setVisible(true);
       }
     }
   }
 }