private void invokePopupIfNeeded(@NotNull EditorMouseEvent event) {
    if (myPopupHandlers.isEmpty()) return;

    if (event.getArea() == EditorMouseEventArea.EDITING_AREA && event.getMouseEvent().isPopupTrigger() && !event.isConsumed()) {
      if (ContainerUtil.all(myPopupHandlers, o -> o instanceof ContextMenuPopupHandler)) {
        ActionGroup group = getPopupActionGroup(event);
        if (group == null) return;
        if (group instanceof DefaultActionGroup o && o.getChildrenCount() == 0 &&
            group.getClass() == DefaultActionGroup.class) return;
        new ContextMenuPopupHandler.Simple(group).handlePopup(event);
      }
      else {
        String message = "Non-ContextMenuPopupHandler popup handler detected: " +
                         ContainerUtil.map(myPopupHandlers, o -> o.getClass().getName());
        if (ClientId.isCurrentlyUnderLocalId()) {
          LOG.warn(message);
        }
        else {
          LOG.error(message);
        }
        for (int i = myPopupHandlers.size() - 1; i >= 0; i--) {
          if (myPopupHandlers.get(i).handlePopup(event)) break;
        }
      }
    }
  }
private void invokePopupIfNeeded(@NotNull EditorMouseEvent event)