JComponent (@NotNull JComponent toolbarTarget) { boolean[] enabledArray = new boolean[3]; Arrays.fill(enabledArray, true); AnAction[] actionsArray = new AnAction[3]; actionsArray[0] = new MyAction("Play", AllIcons.Actions.Execute) { @Override public void update(@NotNull AnActionEvent e) { e.getPresentation().setEnabled(enabledArray[0]); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.EDT; } @Override public void actionPerformed(@NotNull AnActionEvent e) { if (--counter == 0) { enabledArray[0] = false; } System.out.println(e.getPresentation().getDescription() + ", counter = " + counter); } }; actionsArray[1] = new MyAction("Stop", AllIcons.Actions.Suspend) { @Override public void update(@NotNull AnActionEvent e) { e.getPresentation().setEnabled(enabledArray[1]); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.EDT; } @Override public void actionPerformed(@NotNull AnActionEvent e) { counter = 5; enabledArray[0] = true; System.out.println(e.getPresentation().getDescription() + ", counter = " + counter); } }; actionsArray[2] = new MyToggleAction("Mute", AllIcons.Debugger.MuteBreakpoints) { @Override public void update(@NotNull AnActionEvent e) { e.getPresentation().setEnabled(enabledArray[2]); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.EDT; } @Override public void actionPerformed(@NotNull AnActionEvent e) { selected = !selected; if (selected) { System.out.println("Unmute buttons"); enabledArray[0] = true; enabledArray[1] = true; } else { System.out.println("Mute buttons"); enabledArray[0] = false; enabledArray[1] = false; } Toggleable.setSelected(e.getPresentation(), selected); } }; DefaultActionGroup actions = DefaultActionGroup.createFlatGroup(() -> "Simple group"); actions.addAll(actionsArray); DefaultActionGroup subActions = DefaultActionGroup.createPopupGroup(() -> "Ratings"); subActions.getTemplatePresentation().setIcon(AllIcons.Ide.Rating); subActions.addAll(new MyAction("Rating one", AllIcons.Ide.Rating1).withDefaultDescription(), new MyAction("Rating two", AllIcons.Ide.Rating2).withDefaultDescription(), new MyAction("Rating three", AllIcons.Ide.Rating3).withDefaultDescription(), new MyAction("Rating four", AllIcons.Ide.Rating4).withDefaultDescription()); actions.add(subActions); DefaultActionGroup toolbarActions = new DefaultActionGroup(); toolbarActions.add(new SplitButtonAction(actions)); toolbarActions.add(new MyAction("Short", AllIcons.Ide.Rating1) { { GotItTooltip actionGotIt = new GotItTooltip("short.action", "Short action text", project).withHeader("Header"); actionGotIt.assignTo(getTemplatePresentation(), GotItTooltip.BOTTOM_MIDDLE); } }.withShortCut("control K")); toolbarActions.add(new MyAction("Long", AllIcons.Ide.Rating2).withShortCut("control N")); toolbarActions.add(new MyAction(null, AllIcons.Ide.Rating3).withShortCut("control P")); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("TOP", toolbarActions, true); toolbar.setTargetComponent(toolbarTarget); JComponent toolbarComponent = toolbar.getComponent(); toolbarComponent.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM)); return toolbarComponent; }