public static void acceptObjectIconAndText(@Nullable Object obj, @NotNull CustomPresentationConsumer consumer) {
    @NotNull String text;
    @Nullable String description = null;
    Icon icon = null;
    if (obj instanceof Group group) {
      String name = group.getName();
      @NlsSafe String id = group.getId();
      text = name != null ? name : Objects.requireNonNullElse(id, IdeBundle.message("action.group.name.unnamed.group"));
      icon = group.getIcon();
      if (UISettings.getInstance().getShowInplaceCommentsInternal()) {
        description = id;
      }
    }
    else if (obj instanceof String actionId) {
      AnAction action = ActionManager.getInstance().getAction(actionId);
      String name = action != null ? action.getTemplatePresentation().getText() : null;
      text = !StringUtil.isEmptyOrSpaces(name) ? name : actionId;
      if (action != null) {
        Icon actionIcon = action.getTemplatePresentation().getIcon();
        if (actionIcon != null) {
          icon = actionIcon;
        }
      }
      if (UISettings.getInstance().getShowInplaceCommentsInternal()) {
        description = actionId;
      }
    }
    else if (obj instanceof Pair<?, ?> pair) {
      Object actionIdOrGroup = pair.first;
      String actionId = actionIdOrGroup instanceof Group group ? group.getId() : (String)actionIdOrGroup;
      AnAction action = actionId == null ? null : ActionManager.getInstance().getAction(actionId);
      var t = action != null ? action.getTemplatePresentation().getText() : null;
      text = Strings.isNotEmpty(t) ? t : Objects.requireNonNullElse(actionId, IdeBundle.message("action.group.name.unnamed.group"));
      Icon actionIcon = (Icon)pair.second;
      if (actionIcon == null && action != null) {
        actionIcon = action.getTemplatePresentation().getClientProperty(CustomActionsSchema.PROP_ORIGINAL_ICON);
      }
      icon = actionIcon;
      if (UISettings.getInstance().getShowInplaceCommentsInternal()) {
        description = actionId;
      }
    }
    else if (obj instanceof Separator) {
      text = "-------------";
    }
    else if (obj instanceof QuickList quickList) {
      text = quickList.getDisplayName();
      if (UISettings.getInstance().getShowInplaceCommentsInternal()) {
        description = quickList.getActionId();
      }
    }
    else if (obj == null) {
      //noinspection HardCodedStringLiteral
      text = "null";
    }
    else {
      throw new IllegalArgumentException("unknown obj: " + obj);
    }
    consumer.accept(text, description, icon);
  }
public static void acceptObjectIconAndText(@Nullable Object obj, @NotNull CustomPresentationConsumer consumer)