@Override
 public void actionPerformed(AnActionEvent e) {
   ExecutionTargetManager.setActiveTarget(myProject, myTarget);
   updatePresentation(
       ExecutionTargetManager.getActiveTarget(myProject),
       RunManagerEx.getInstanceEx(myProject).getSelectedConfiguration(),
       myProject,
       e.getPresentation());
 }
 @Override
 public void actionPerformed(final AnActionEvent e) {
   RunManager.getInstance(myProject).setSelectedConfiguration(myConfiguration);
   updatePresentation(
       ExecutionTargetManager.getActiveTarget(myProject),
       myConfiguration,
       myProject,
       e.getPresentation());
 }
  @Override
  @NotNull
  protected DefaultActionGroup createPopupActionGroup(final JComponent button) {
    final DefaultActionGroup allActionsGroup = new DefaultActionGroup();
    final Project project =
        CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(button));
    if (project != null) {
      final RunManagerEx runManager = RunManagerEx.getInstanceEx(project);

      allActionsGroup.add(
          ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_RUN_CONFIGURATIONS));
      allActionsGroup.add(new SaveTemporaryAction());
      allActionsGroup.addSeparator();

      RunnerAndConfigurationSettings selected =
          RunManager.getInstance(project).getSelectedConfiguration();
      if (selected != null) {
        ExecutionTarget activeTarget = ExecutionTargetManager.getActiveTarget(project);
        for (ExecutionTarget eachTarget :
            ExecutionTargetManager.getTargetsToChooseFor(project, selected)) {
          allActionsGroup.add(
              new SelectTargetAction(project, eachTarget, eachTarget.equals(activeTarget)));
        }
        allActionsGroup.addSeparator();
      }

      final ConfigurationType[] types = runManager.getConfigurationFactories();
      for (ConfigurationType type : types) {
        final DefaultActionGroup actionGroup = new DefaultActionGroup();
        Map<String, List<RunnerAndConfigurationSettings>> structure = runManager.getStructure(type);
        for (Map.Entry<String, List<RunnerAndConfigurationSettings>> entry : structure.entrySet()) {
          DefaultActionGroup group =
              entry.getKey() != null ? new DefaultActionGroup(entry.getKey(), true) : actionGroup;
          group.getTemplatePresentation().setIcon(AllIcons.Nodes.Folder);
          for (RunnerAndConfigurationSettings settings : entry.getValue()) {
            group.add(new SelectConfigAction(settings, project));
          }
          if (group != actionGroup) {
            actionGroup.add(group);
          }
        }

        allActionsGroup.add(actionGroup);
        allActionsGroup.addSeparator();
      }
    }
    return allActionsGroup;
  }
 @Override
 public void update(AnActionEvent e) {
   Presentation presentation = e.getPresentation();
   Project project = e.getData(CommonDataKeys.PROJECT);
   if (ActionPlaces.isMainMenuOrActionSearch(e.getPlace())) {
     presentation.setDescription(
         ExecutionBundle.message("choose.run.configuration.action.description"));
   }
   try {
     if (project == null || project.isDisposed() || !project.isInitialized()) {
       updatePresentation(null, null, null, presentation);
       presentation.setEnabled(false);
     } else {
       updatePresentation(
           ExecutionTargetManager.getActiveTarget(project),
           RunManagerEx.getInstanceEx(project).getSelectedConfiguration(),
           project,
           presentation);
       presentation.setEnabled(true);
     }
   } catch (IndexNotReadyException e1) {
     presentation.setEnabled(false);
   }
 }