コード例 #1
0
    private void calcMaxIconSize(final ActionGroup actionGroup) {
      AnAction[] actions = actionGroup.getChildren(createActionEvent(actionGroup));
      for (AnAction action : actions) {
        if (action == null) continue;
        if (action instanceof ActionGroup) {
          final ActionGroup group = (ActionGroup) action;
          if (!group.isPopup()) {
            calcMaxIconSize(group);
            continue;
          }
        }

        Icon icon = action.getTemplatePresentation().getIcon();
        if (icon == null && action instanceof Toggleable) icon = PlatformIcons.CHECK_ICON;
        if (icon != null) {
          final int width = icon.getIconWidth();
          final int height = icon.getIconHeight();
          if (myMaxIconWidth < width) {
            myMaxIconWidth = width;
          }
          if (myMaxIconHeight < height) {
            myMaxIconHeight = height;
          }
        }
      }
    }
コード例 #2
0
 private void appendActionsFromGroup(@NotNull ActionGroup actionGroup) {
   AnAction[] actions = actionGroup.getChildren(createActionEvent(actionGroup));
   for (AnAction action : actions) {
     if (action == null) {
       LOG.error("null action in group " + actionGroup);
       continue;
     }
     if (action instanceof Separator) {
       myPrependWithSeparator = true;
       mySeparatorText = ((Separator) action).getText();
     } else {
       if (action instanceof ActionGroup) {
         ActionGroup group = (ActionGroup) action;
         if (group.isPopup()) {
           appendAction(group);
         } else {
           appendActionsFromGroup(group);
         }
       } else {
         appendAction(action);
       }
     }
   }
 }