JComponent () { List<Action> actions = new ArrayList<>(ContainerUtil.filter(createActions(), Conditions.notNull())); List<Action> leftSideActions = new ArrayList<>(ContainerUtil.filter(createLeftSideActions(), Conditions.notNull())); Action helpAction = getHelpAction(); boolean addHelpToLeftSide = false; if (isRemoveHelpButton()) { actions.remove(helpAction); } else if (!actions.contains(helpAction) && getHelpId() == null) { helpAction.setEnabled(false); } else if (isMoveHelpButtonLeft() && actions.remove(helpAction) && !leftSideActions.contains(helpAction)) { addHelpToLeftSide = true; } if (!Registry.is("ide.allow.merge.buttons", true)) { actions = flattenOptionsActions(actions); leftSideActions = flattenOptionsActions(leftSideActions); } if (SystemInfoRt.isMac) { Action macOtherAction = ContainerUtil.find(actions, MacOtherAction.class::isInstance); if (macOtherAction != null) { leftSideActions.add(macOtherAction); actions.remove(macOtherAction); } sortActionsOnMac(actions); } List<JButton> leftSideButtons = createButtons(leftSideActions); List<JButton> rightSideButtons = createButtons(actions); myButtonMap.clear(); for (JButton button : ContainerUtil.concat(leftSideButtons, rightSideButtons)) { myButtonMap.put(button.getAction(), button); if (button instanceof JBOptionButton) { optionButtons.add((JBOptionButton)button); } } JComponent result = createSouthPanel(leftSideButtons, rightSideButtons, addHelpToLeftSide); if (LoadingState.COMPONENTS_REGISTERED.isOccurred() && ApplicationManager.getApplication() != null) { Touchbar.setButtonActions(result, leftSideButtons, rightSideButtons, null); } return result; }