private static void showDialog(ApplicationImpl app) {
    DialogWrapper dialog =
        new DialogWrapper(null) {
          {
            setTitle("Some Modal Dialog");
            init();
          }

          @Nullable
          @Override
          protected JComponent createCenterPanel() {
            return new JTextField("Waiting for the progress...");
          }
        };
    EdtExecutorService.getScheduledExecutorInstance()
        .schedule(
            () -> {
              app.runWriteActionWithProgress(
                  "Progress in modal dialog",
                  null,
                  dialog.getRootPane(),
                  TestWriteActionUnderProgress::runDeterminateProgress);
              dialog.close(0);
            },
            2500,
            TimeUnit.MILLISECONDS);
    app.invokeLater(
        () -> {
          dialog.setSize(100, 100);
          dialog.setLocation(100, 100);
        },
        ModalityState.any());
    dialog.show();
  }
 @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);
 }