public void refreshPresentation() {
   // 1. vertical 2. number of lines 3. soft wraps (4. ignore spaces)
   PresentationState current = new PresentationState();
   if (myFragmentedContent != null && !Comparing.equal(myPresentationState, current)) {
     myFragmentedContent.recalculate();
     refreshData(myFragmentedContent);
   }
   myPreviousDiff.registerCustomShortcutSet(myPreviousDiff.getShortcutSet(), myParent);
   myNextDiff.registerCustomShortcutSet(myNextDiff.getShortcutSet(), myParent);
 }
  public void refreshData(final PreparedFragmentedContent fragmentedContent) {
    myPresentationState = new PresentationState();
    myFragmentedContent = fragmentedContent;

    boolean navigationEnabled = !myFragmentedContent.isOneSide();
    myNextDiff.setEnabled(navigationEnabled);
    myPreviousDiff.setEnabled(navigationEnabled);

    adjustPanelData((DiffPanelImpl) myHorizontal);
    adjustPanelData((DiffPanelImpl) myVertical);

    DiffPanel currentPanel = getCurrentPanel();
    FragmentedDiffPanelState state =
        (FragmentedDiffPanelState) ((DiffPanelImpl) currentPanel).getDiffPanelState();
    myTitleLabel.setText(titleText((DiffPanelImpl) currentPanel));
    myLeftLines = state.getLeftLines();
    myRightLines = state.getRightLines();

    FragmentedEditorHighlighter bh = fragmentedContent.getBeforeHighlighter();
    if (bh != null) {
      ((EditorEx) ((DiffPanelImpl) currentPanel).getEditor1()).setHighlighter(bh);
    }
    FragmentedEditorHighlighter ah = fragmentedContent.getAfterHighlighter();
    if (ah != null) {
      ((EditorEx) ((DiffPanelImpl) currentPanel).getEditor2()).setHighlighter(ah);
    }
    if (((DiffPanelImpl) currentPanel).getEditor1() != null) {
      highlightTodo(true, fragmentedContent.getBeforeTodoRanges());
    }
    if (((DiffPanelImpl) currentPanel).getEditor2() != null) {
      highlightTodo(false, fragmentedContent.getAfterTodoRanges());
    }
    ensurePresentation();
    softWraps(myConfiguration.SOFT_WRAPS_IN_SHORT_DIFF);
  }
 @Override
 public void dispose() {
   // to remove links to editor that is in scrolling helper
   myPanel.removeAll();
   myHorizontal = null;
   myVertical = null;
   myPreviousDiff.unregisterCustomShortcutSet(myParent);
   myNextDiff.unregisterCustomShortcutSet(myParent);
 }
  public void buildUi() {
    myTopPanel = new JPanel(new BorderLayout());
    final JPanel wrapper = new JPanel();
    // final BoxLayout boxLayout = new BoxLayout(wrapper, BoxLayout.X_AXIS);
    wrapper.setLayout(new BorderLayout());
    myTitleLabel.setBorder(BorderFactory.createEmptyBorder(1, 2, 0, 0));
    wrapper.add(myTitleLabel, BorderLayout.WEST);
    DefaultActionGroup dag = new DefaultActionGroup();
    myPreviousDiff.copyShortcutFrom(ActionManager.getInstance().getAction("PreviousDiff"));
    myNextDiff.copyShortcutFrom(ActionManager.getInstance().getAction("NextDiff"));
    dag.add(new MyChangeContextAction());
    dag.add(myPreviousDiff);
    dag.add(myNextDiff);
    myPreviousDiff.registerCustomShortcutSet(myPreviousDiff.getShortcutSet(), myPanel);
    myNextDiff.registerCustomShortcutSet(myNextDiff.getShortcutSet(), myPanel);

    dag.add(new PopupAction());
    ActionToolbar toolbar =
        ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, dag, true);
    wrapper.add(toolbar.getComponent(), BorderLayout.EAST);

    myTopPanel.add(wrapper, BorderLayout.CENTER);

    final JPanel wrapperDiffs = new JPanel(new GridBagLayout());
    final JPanel oneMore = new JPanel(new BorderLayout());
    oneMore.add(wrapperDiffs, BorderLayout.NORTH);

    myCurrentHorizontal = myConfiguration.SHORT_DIFF_HORISONTALLY;
    myHorizontal = createPanel(true);
    myVertical = createPanel(false);

    myPanel.add(myTopPanel, BorderLayout.NORTH);
    myPanel.add(getCurrentPanel().getComponent(), BorderLayout.CENTER);

    myPreviousDiff.registerCustomShortcutSet(myPreviousDiff.getShortcutSet(), myParent);
    myNextDiff.registerCustomShortcutSet(myNextDiff.getShortcutSet(), myParent);
  }
 public void away() {
   myPreviousDiff.unregisterCustomShortcutSet(myParent);
   myNextDiff.unregisterCustomShortcutSet(myParent);
 }