DefaultActionGroup (AnAction @NotNull [] restartActions, AnAction @NotNull [] consoleActions, AnAction @NotNull [] additionalActions) { boolean isNewLayout = UIExperiment.isNewDebuggerUIEnabled(); String mainGroupId = isNewLayout ? RUN_TOOL_WINDOW_TOP_TOOLBAR_GROUP : RUN_TOOL_WINDOW_TOP_TOOLBAR_OLD_GROUP; ActionGroup toolbarGroup = (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(mainGroupId); AnAction[] mainChildren = toolbarGroup.getChildren(null); DefaultActionGroup actionGroup = new DefaultActionGroupWithDelegate(toolbarGroup); actionGroup.addAll(mainChildren); DefaultActionGroup afterRunActions = new DefaultActionGroup(restartActions); if (!isNewLayout) { afterRunActions.add(new CreateAction(AllIcons.General.Settings)); afterRunActions.addSeparator(); } MoreActionGroup moreGroup = null; if (isNewLayout) { moreGroup = new MoreActionGroup(); ActionGroup moreActionGroup = (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(RUN_TOOL_WINDOW_TOP_TOOLBAR_MORE_GROUP); moreGroup.addAll(removeDuplicatesExceptSeparators(moreActionGroup.getChildren(null), Arrays.asList(mainChildren))); } addActionsWithConstraints(afterRunActions.getChildren(null), new Constraints(AFTER, IdeActions.ACTION_RERUN), actionGroup, moreGroup); DefaultActionGroup afterStopActions = new DefaultActionGroup(myExecutionResult.getActions()); if (consoleActions.length > 0) { afterStopActions.addSeparator(); afterStopActions.addAll(consoleActions); } if (!isNewLayout) { for (AnAction anAction : myRunnerActions) { if (anAction != null) { afterStopActions.add(anAction); } else { afterStopActions.addSeparator(); } } addActionsWithConstraints(afterStopActions.getChildren(null), new Constraints(AFTER, IdeActions.ACTION_STOP_PROGRAM), actionGroup, null); actionGroup.addSeparator(); actionGroup.add(myUi.getOptions().getLayoutActions()); actionGroup.addSeparator(); actionGroup.add(PinToolwindowTabAction.getPinAction()); } else { afterStopActions.addSeparator(); afterStopActions.addAll(myRunnerActions); addActionsWithConstraints(afterStopActions.getChildren(null), new Constraints(AFTER, IdeActions.ACTION_STOP_PROGRAM), actionGroup, moreGroup); moreGroup.addSeparator(); if (additionalActions.length > 0) { moreGroup.addSeparator(); moreGroup.addAll(additionalActions); } actionGroup.add(moreGroup); moreGroup.add(new CreateAction()); } return actionGroup; }