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());
    }
  }
  public void show(DiffRequest request) {
    Collection hints = request.getHints();
    boolean shouldOpenDialog = shouldOpenDialog(hints);
    if (shouldOpenDialog) {
      final DialogBuilder builder = new DialogBuilder(request.getProject());
      DiffPanelImpl diffPanel =
          createDiffPanelIfShouldShow(request, builder.getWindow(), builder, true);
      if (diffPanel == null) {
        Disposer.dispose(builder);
        return;
      }
      if (hints.contains(DiffTool.HINT_DIFF_IS_APPROXIMATE)) {
        diffPanel.setPatchAppliedApproximately(); // todo read only and not variants
      }
      final Runnable onOkRunnable = request.getOnOkRunnable();
      if (onOkRunnable != null) {
        builder.setOkOperation(
            new Runnable() {
              @Override
              public void run() {
                builder.getDialogWrapper().close(0);
                onOkRunnable.run();
              }
            });
      } else {
        builder.removeAllActions();
      }
      builder.setCenterPanel(diffPanel.getComponent());
      builder.setPreferredFocusComponent(diffPanel.getPreferredFocusedComponent());
      builder.setTitle(request.getWindowTitle());
      builder.setDimensionServiceKey(request.getGroupKey());

      new AnAction() {
        public void actionPerformed(final AnActionEvent e) {
          builder.getDialogWrapper().close(0);
        }
      }.registerCustomShortcutSet(
          new CustomShortcutSet(
              KeymapManager.getInstance().getActiveKeymap().getShortcuts("CloseContent")),
          diffPanel.getComponent());
      showDiffDialog(builder, hints);
    } else {
      final FrameWrapper frameWrapper =
          new FrameWrapper(request.getProject(), request.getGroupKey());
      DiffPanelImpl diffPanel =
          createDiffPanelIfShouldShow(request, frameWrapper.getFrame(), frameWrapper, true);
      if (diffPanel == null) {
        Disposer.dispose(frameWrapper);
        return;
      }
      if (hints.contains(DiffTool.HINT_DIFF_IS_APPROXIMATE)) {
        diffPanel.setPatchAppliedApproximately();
      }
      frameWrapper.setTitle(request.getWindowTitle());
      DiffUtil.initDiffFrame(
          diffPanel.getProject(), frameWrapper, diffPanel, diffPanel.getComponent());

      new AnAction() {
        public void actionPerformed(final AnActionEvent e) {
          frameWrapper.getFrame().dispose();
        }
      }.registerCustomShortcutSet(
          new CustomShortcutSet(
              KeymapManager.getInstance().getActiveKeymap().getShortcuts("CloseContent")),
          diffPanel.getComponent());

      frameWrapper.show();
    }
  }