public static void deleteConfiguration(@NotNull Project project,
                                         @NotNull RunnerAndConfigurationSettings configurationSettings,
                                         @Nullable JBPopup popupToCancel) {
    RunManagerConfig runManagerConfig = RunManagerImpl.getInstanceImpl(project).getConfig();
    boolean confirmed;
    if (runManagerConfig.isDeletionFromPopupRequiresConfirmation()) {
      if (popupToCancel != null) {
        popupToCancel.cancel();
      }

      confirmed = MessageDialogBuilder.yesNo(CommonBundle.message("title.confirmation"),
                                             ExecutionBundle.message("are.you.sure.you.want.to.delete.0", configurationSettings.getName()))
                    .doNotAsk(new DoNotAskOption.Adapter() {
                      @Override
                      public void rememberChoice(boolean isSelected, int exitCode) {
                        runManagerConfig.setDeletionFromPopupRequiresConfirmation(!isSelected);
                      }

                      @Override
                      public @NotNull String getDoNotShowMessage() {
                        return ExecutionBundle.message("don.t.ask.again");
                      }

                      @Override
                      public boolean shouldSaveOptionsOnCancel() {
                        return true;
                      }
                    })
                    .ask(project);
    }
    else {
      confirmed = true;
    }
    if (confirmed) {
      RunManager.getInstance(project).removeConfiguration(configurationSettings);
    }
  }
public static void deleteConfiguration(@NotNull Project project,
                                         @NotNull RunnerAndConfigurationSettings configurationSettings,
                                         @Nullable JBPopup popupToCancel)