protected final void registerActions(@NotNull ActionRuntimeRegistrar actionRegistrar) {
    unregisterActions(actionRegistrar);

    // register
    // to prevent exception if 2 or more targets have the same name
    Set<String> registeredIds = new HashSet<>();
    for (ToolsGroup<T> group : mySchemeManager.getAllSchemes()) {
      String groupName = group.getName();
      if (!StringUtil.isEmptyOrSpaces(groupName)) {
        String groupId = getGroupIdPrefix() + groupName;
        if (registeredIds.add(groupId)) {
          ToolActionGroup<T> actionGroup = new ToolActionGroup<>(group);
          actionGroup.getTemplatePresentation().setText(group.getName(), false);
          actionGroup.getTemplatePresentation().setPopupGroup(true);
          actionRegistrar.registerAction(groupId, actionGroup);
        }
      }
      for (T tool : group.getElements()) {
        String actionId = tool.getActionId();
        if (registeredIds.add(actionId)) {
          actionRegistrar.registerAction(actionId, createToolAction(tool));
        }
      }
    }
    actionRegistrar.registerAction(getRootGroupId(), new ActionGroup() {
      @Override
      public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e) {
        ActionManager am = e != null ? e.getActionManager() : ActionManager.getInstance();
        return ContainerUtil.mapNotNull(mySchemeManager.getAllSchemes(), o -> {
            String groupName = o.getName();
            return !StringUtil.isEmptyOrSpaces(groupName) ? am.getAction(getGroupIdPrefix() + groupName) :
                   new ToolActionGroup<>(o);
          })
          .toArray(EMPTY_ARRAY);
      }
    });
  }
protected final void registerActions(@NotNull ActionRuntimeRegistrar actionRegistrar)