private AllResolvedListener(MergePanel2 mergePanel, DialogWrapper dialogWrapper) {
   myMergePanel = mergePanel;
   myDialogWrapper = dialogWrapper;
   final ChangeCounter changeCounter = ChangeCounter.getOrCreate(myMergePanel.getMergeList());
   changeCounter.removeListener(this);
   changeCounter.addListener(this);
 }
 @Override
 public void run() {
   if (myWasInvoked) return;
   if (!getWholePanel().isDisplayable()) return;
   myWasInvoked = true;
   ChangeCounter.getOrCreate(myMergePanel.getMergeList()).removeListener(this);
   int doApply =
       Messages.showOkCancelDialog(
           getWholePanel(),
           DiffBundle.message(
               "merge.all.changes.have.processed.save.and.finish.confirmation.text"),
           DiffBundle.message("all.changes.processed.dialog.title"),
           DiffBundle.message("merge.save.and.finish.button"),
           DiffBundle.message("merge.continue.button"),
           Messages.getQuestionIcon());
   if (doApply != Messages.OK) return;
   myDialogWrapper.close(DialogWrapper.OK_EXIT_CODE);
 }
  public void setActions(
      final DialogBuilder builder,
      MergePanel2 mergePanel,
      final Convertor<DialogWrapper, Boolean> preOkHook) {
    builder.removeAllActions(); // otherwise dialog will get default actions (OK, Cancel)

    if (myOkButtonPresentation != null) {
      if (builder.getOkAction() == null) {
        builder.addOkAction();
      }

      configureAction(builder, builder.getOkAction(), myOkButtonPresentation);
      builder.setOkOperation(
          new Runnable() {
            @Override
            public void run() {
              if (preOkHook != null && !preOkHook.convert(builder.getDialogWrapper())) return;
              myOkButtonPresentation.run(builder.getDialogWrapper());
            }
          });
    }

    if (myCancelButtonPresentation != null) {
      if (builder.getCancelAction() == null) {
        builder.addCancelAction();
      }

      configureAction(builder, builder.getCancelAction(), myCancelButtonPresentation);
      builder.setCancelOperation(
          new Runnable() {
            @Override
            public void run() {
              myCancelButtonPresentation.run(builder.getDialogWrapper());
            }
          });
    }

    if (getMergeContent() != null && mergePanel.getMergeList() != null) {
      new AllResolvedListener(mergePanel, builder.getDialogWrapper());
    }
  }
 private JComponent getWholePanel() {
   return myMergePanel.getComponent();
 }