void (String actionName, String anchorActionName, ActionManager manager, List<? super AnAction> actions) { AnAction action = manager.getAction(actionName); assert action != null : "Can not find action " + actionName; AnAction anchorAction = manager.getAction(anchorActionName); assert anchorAction != null : "Can not find action " + anchorActionName; int index = actions.indexOf(anchorAction); actions.add(index >= 0 ? index + 1 : actions.size(), action); }