void (@NotNull List<AnAction> list, @NotNull String actionText, @NotNull String targetActionText, boolean before) { if (Objects.equals(actionText, targetActionText)) { return; } int actionIndex = -1; int targetIndex = -1; for (int i = 0; i < list.size(); i++) { AnAction action = list.get(i); if (actionIndex == -1 && Objects.equals(actionText, action.getTemplateText())) actionIndex = i; if (targetIndex == -1 && Objects.equals(targetActionText, action.getTemplateText())) targetIndex = i; if (actionIndex != -1 && targetIndex != -1) { if (actionIndex < targetIndex) targetIndex--; AnAction anAction = list.remove(actionIndex); list.add(before ? targetIndex : targetIndex + 1, anAction); return; } } }