protected void fillToolBar(@NotNull List<? extends AnAction> actions, boolean layoutSecondaries) {
    boolean isLastElementSeparator = false;
    List<AnAction> rightAligned = new ArrayList<>();
    for (int i = 0; i < actions.size(); i++) {
      AnAction action = actions.get(i);
      if (isAlignmentEnabled() && action instanceof RightAlignedToolbarAction || forceRightAlignment()) {
        rightAligned.add(action);
        continue;
      }

      if (layoutSecondaries) {
        if (!myActionGroup.isPrimary(action)) {
          mySecondaryActions.add(action);
          continue;
        }
      }

      if (action instanceof Separator) {
        if (isLastElementSeparator) continue;
        if (i > 0 && i < actions.size() - 1) {
          add(SEPARATOR_CONSTRAINT, mySeparatorCreator.apply(myShowSeparatorTitles ? ((Separator)action).getText() : null));
          isLastElementSeparator = true;
          continue;
        }
      }
      else {
        addActionButtonImpl(action, -1);
      }
      isLastElementSeparator = false;
    }

    if (mySecondaryActions.getChildrenCount() > 0) {
      Dimension minimumSize = isInsideNavBar() ? NAVBAR_MINIMUM_BUTTON_SIZE : DEFAULT_MINIMUM_BUTTON_SIZE;
      mySecondaryActionsButton =
        new ActionButton(mySecondaryActions, myPresentationFactory.getPresentation(mySecondaryActions), myPlace, minimumSize) {
          @Override
          protected String getShortcutText() {
            String shortcut = myPresentation.getClientProperty(SECONDARY_SHORTCUT);
            return shortcut != null ? shortcut : super.getShortcutText();
          }
        };
      mySecondaryActionsButton.setNoIconsInPopup(true);
      mySecondaryActionsButton.putClientProperty(ActionToolbar.SECONDARY_ACTION_PROPERTY, Boolean.TRUE);
      add(SECONDARY_ACTION_CONSTRAINT, mySecondaryActionsButton);
    }

    for (AnAction action : rightAligned) {
      JComponent button = action instanceof CustomComponentAction ? getCustomComponent(action) : createToolbarButton(action);
      if (!isInsideNavBar()) {
        button.putClientProperty(ToolbarLayoutUtilKt.RIGHT_ALIGN_KEY, Boolean.TRUE);
      }
      add(button);
    }
  }
protected void fillToolBar(@NotNull List<? extends AnAction> actions, boolean layoutSecondaries)