private static void unregisterAction(@NotNull String actionId,
                                       @NotNull String groupId,
                                       @NotNull Map<String, AnAction> map,
                                       @NotNull ActionManager actionManager) {
    DefaultActionGroup group = (DefaultActionGroup)actionManager.getAction(groupId);
    if (group == null) {
      return;
    }

    AnAction action = map.get(actionId);
    if (action == null) {
      action = actionManager.getAction(actionId);
      if (action != null) {
        group.remove(action, actionManager);
      }
    }
    else {
      actionManager.unregisterAction(actionId);
      map.remove(actionId);
    }
  }
private static void unregisterAction(@NotNull String actionId,
                                       @NotNull String groupId,
                                       @NotNull Map<String, AnAction> map,
                                       @NotNull ActionManager actionManager)