public static void updateRunConfigurationActions(Project project, ProjectSystemId systemId) {
    final AbstractExternalSystemTaskConfigurationType configurationType =
        ExternalSystemUtil.findConfigurationType(systemId);
    if (configurationType == null) return;

    ActionManager actionManager = ActionManager.getInstance();
    for (String eachAction : actionManager.getActionIds(getActionPrefix(project, null))) {
      AnAction action = actionManager.getAction(eachAction);
      if (action instanceof ExternalSystemRunConfigurationAction) {
        actionManager.unregisterAction(eachAction);
      }
    }

    Set<RunnerAndConfigurationSettings> settings =
        new THashSet<RunnerAndConfigurationSettings>(
            RunManager.getInstance(project).getConfigurationSettingsList(configurationType));

    final ExternalSystemShortcutsManager shortcutsManager =
        ExternalProjectsManager.getInstance(project).getShortcutsManager();
    for (RunnerAndConfigurationSettings configurationSettings : settings) {
      ExternalSystemRunConfigurationAction runConfigurationAction =
          new ExternalSystemRunConfigurationAction(project, configurationSettings);
      String id = runConfigurationAction.getId();
      actionManager.unregisterAction(id);
      if (shortcutsManager.hasShortcuts(id)) {
        actionManager.registerAction(id, runConfigurationAction);
      }
    }
  }
 public static void clearActions(Project project) {
   ActionManager manager = ActionManager.getInstance();
   if (manager != null) {
     for (String each : manager.getActionIds(getActionPrefix(project, null))) {
       manager.unregisterAction(each);
     }
   }
 }
 public static void clearActions(Project project, Collection<DataNode<TaskData>> taskData) {
   ActionManager actionManager = ActionManager.getInstance();
   if (actionManager != null) {
     for (DataNode<TaskData> each : taskData) {
       for (String eachAction :
           actionManager.getActionIds(
               getActionPrefix(project, each.getData().getLinkedExternalProjectPath()))) {
         AnAction action = actionManager.getAction(eachAction);
         if (!(action instanceof ExternalSystemRunConfigurationAction)) {
           actionManager.unregisterAction(eachAction);
         }
       }
     }
   }
 }
  public KeymapGroup createGroup(Condition<AnAction> condition, final Project project) {
    KeymapGroup result =
        KeymapGroupFactory.getInstance()
            .createGroup(
                ExternalSystemBundle.message("external.system.keymap.group"),
                ExternalSystemIcons.TaskGroup);
    if (project == null) return result;

    MultiMap<ProjectSystemId, String> projectToActionsMapping = MultiMap.create();
    for (ExternalSystemManager<?, ?, ?, ?, ?> manager : ExternalSystemApiUtil.getAllManagers()) {
      projectToActionsMapping.putValues(manager.getSystemId(), ContainerUtil.<String>emptyList());
    }

    ActionManager actionManager = ActionManager.getInstance();
    if (actionManager != null) {
      for (String eachId : actionManager.getActionIds(getActionPrefix(project, null))) {
        AnAction eachAction = actionManager.getAction(eachId);

        if (!(eachAction instanceof MyExternalSystemAction)) continue;
        if (condition != null && !condition.value(actionManager.getActionOrStub(eachId))) continue;

        MyExternalSystemAction taskAction = (MyExternalSystemAction) eachAction;
        projectToActionsMapping.putValue(taskAction.getSystemId(), eachId);
      }
    }

    Map<ProjectSystemId, KeymapGroup> keymapGroupMap = ContainerUtil.newHashMap();
    for (ProjectSystemId systemId : projectToActionsMapping.keySet()) {
      if (!keymapGroupMap.containsKey(systemId)) {
        final Icon projectIcon = ExternalSystemUiUtil.getUiAware(systemId).getProjectIcon();
        KeymapGroup group =
            KeymapGroupFactory.getInstance().createGroup(systemId.getReadableName(), projectIcon);
        result.addGroup(group);
        keymapGroupMap.put(systemId, group);
      }
    }

    for (Map.Entry<ProjectSystemId, Collection<String>> each : projectToActionsMapping.entrySet()) {
      Collection<String> tasks = each.getValue();
      final ProjectSystemId systemId = each.getKey();
      final KeymapGroup systemGroup = keymapGroupMap.get(systemId);
      for (String actionId : tasks) {
        systemGroup.addActionId(actionId);
      }
      if (systemGroup instanceof Group) {
        Icon icon =
            SystemInfoRt.isMac ? AllIcons.ToolbarDecorator.Mac.Add : AllIcons.ToolbarDecorator.Add;
        ((Group) systemGroup)
            .addHyperlink(
                new Hyperlink(icon, "Choose a task to assign a shortcut") {
                  @Override
                  public void onClick(MouseEvent e) {
                    SelectExternalTaskDialog dialog =
                        new SelectExternalTaskDialog(systemId, project);
                    if (dialog.showAndGet() && dialog.getResult() != null) {
                      TaskData taskData = dialog.getResult().second;
                      String ownerModuleName = dialog.getResult().first;
                      ExternalSystemTaskAction externalSystemAction =
                          (ExternalSystemTaskAction)
                              getOrRegisterAction(project, ownerModuleName, taskData);

                      ApplicationManager.getApplication()
                          .getMessageBus()
                          .syncPublisher(KeymapListener.CHANGE_TOPIC)
                          .processCurrentKeymapChanged();

                      Settings allSettings =
                          Settings.KEY.getData(
                              DataManager.getInstance().getDataContext(e.getComponent()));
                      KeymapPanel keymapPanel =
                          allSettings != null ? allSettings.find(KeymapPanel.class) : null;
                      if (keymapPanel != null) {
                        // clear actions filter
                        keymapPanel.showOption("");
                        keymapPanel.selectAction(externalSystemAction.myId);
                      }
                    }
                  }
                });
      }
    }

    for (ActionsProvider extension : ActionsProvider.EP_NAME.getExtensions()) {
      KeymapGroup group = extension.createGroup(condition, project);
      if (group != null) {
        result.addGroup(group);
      }
    }

    return result;
  }