public void onContentChangedIn(EditorSource source) {
    myDiffUpdater.contentRemoved(source);
    final EditorEx editor = source.getEditor();
    if (myIsHorizontal && source.getSide() == FragmentSide.SIDE1 && editor != null) {
      editor.setVerticalScrollbarOrientation(EditorEx.VERTICAL_SCROLLBAR_LEFT);
    }
    DiffSideView viewSide = getSideView(source.getSide());
    viewSide.setEditorSource(getProject(), source);
    Disposer.dispose(myScrollSupport);
    if (editor == null) {
      if (!myDisposed) {
        rediff();
      }
      return;
    }

    final MouseListener mouseListener =
        PopupHandler.installUnknownPopupHandler(
            editor.getContentComponent(),
            new MergeActionGroup(this, source.getSide()),
            ActionManager.getInstance());
    myDiffUpdater.contentAdded(source);
    editor.getSettings().setLineNumbersShown(true);
    editor.getSettings().setFoldingOutlineShown(false);
    editor.getFoldingModel().setFoldingEnabled(false);
    ((EditorMarkupModel) editor.getMarkupModel()).setErrorStripeVisible(true);

    Editor editor1 = getEditor(FragmentSide.SIDE1);
    Editor editor2 = getEditor(FragmentSide.SIDE2);
    if (editor1 != null && editor2 != null && myIsSyncScroll) {
      myScrollSupport.install(new EditingSides[] {this});
    }

    final VisibleAreaListener visibleAreaListener = mySplitter.getVisibleAreaListener();
    final ScrollingModel scrollingModel = editor.getScrollingModel();
    if (visibleAreaListener != null) {
      scrollingModel.addVisibleAreaListener(visibleAreaListener);
      scrollingModel.addVisibleAreaListener(myVisibleAreaListener);
    }
    myFontSizeSynchronizer.synchronize(editor);
    source.addDisposable(
        new Disposable() {
          public void dispose() {
            myFontSizeSynchronizer.stopSynchronize(editor);
          }
        });
    source.addDisposable(
        new Disposable() {
          public void dispose() {
            if (visibleAreaListener != null) {
              scrollingModel.removeVisibleAreaListener(visibleAreaListener);
              scrollingModel.removeVisibleAreaListener(myVisibleAreaListener);
            }
            editor.getContentComponent().removeMouseListener(mouseListener);
          }
        });
  }
 private void setSplitterProportion(DiffContent content1, DiffContent content2) {
   if (content1.isEmpty()) {
     mySplitter.setProportion(0f);
     mySplitter.setResizeEnabled(false);
     return;
   }
   if (content2.isEmpty()) {
     mySplitter.setProportion(1.0f);
     mySplitter.setResizeEnabled(false);
     return;
   }
   mySplitter.setProportion(0.5f);
   mySplitter.setResizeEnabled(true);
 }
 private void setLineBlocks(@NotNull LineBlocks blocks) {
   myLineBlocks = blocks;
   mySplitter.redrawDiffs();
   updateStatusBar();
 }
  public DiffPanelImpl(
      final Window owner,
      @NotNull Project project,
      boolean enableToolbar,
      boolean horizontal,
      int diffDividerPolygonsOffset,
      DiffTool parentTool) {
    myProject = project;
    myIsHorizontal = horizontal;
    myParentTool = parentTool;
    myOptions = new DiffPanelOptions(this);
    myPanel = new DiffPanelOuterComponent(TextDiffType.DIFF_TYPES, null);
    myPanel.disableToolbar(!enableToolbar);
    if (enableToolbar) myPanel.resetToolbar();
    myOwnerWindow = owner;
    myIsSyncScroll = true;
    final boolean v = !horizontal;
    myLeftSide = new DiffSideView(this, new CustomLineBorder(1, 0, v ? 0 : 1, v ? 0 : 1));
    myRightSide = new DiffSideView(this, new CustomLineBorder(v ? 0 : 1, v ? 0 : 1, 1, 0));
    myLeftSide.becomeMaster();
    myDiffUpdater = new Rediffers(this);

    myDiffDividerPolygonsOffset = diffDividerPolygonsOffset;

    myData = createDiffPanelState(this);

    if (horizontal) {
      mySplitter =
          new DiffSplitter(
              myLeftSide.getComponent(),
              myRightSide.getComponent(),
              new DiffDividerPaint(this, FragmentSide.SIDE1, diffDividerPolygonsOffset),
              myData);
    } else {
      mySplitter =
          new HorizontalDiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent());
    }

    myPanel.insertDiffComponent(mySplitter.getComponent(), new MyScrollingPanel());
    myDataProvider = new MyGenericDataProvider(this);
    myPanel.setDataProvider(myDataProvider);

    ComparisonPolicy comparisonPolicy = getComparisonPolicy();
    ComparisonPolicy defaultComparisonPolicy =
        DiffManagerImpl.getInstanceEx().getComparisonPolicy();
    if (comparisonPolicy != defaultComparisonPolicy) {
      setComparisonPolicy(defaultComparisonPolicy, false);
    }

    HighlightMode highlightMode = getHighlightMode();
    HighlightMode defaultHighlightMode = DiffManagerImpl.getInstanceEx().getHighlightMode();
    if (highlightMode != defaultHighlightMode) {
      setHighlightMode(defaultHighlightMode, false);
    }

    myVisibleAreaListener =
        new VisibleAreaListener() {
          @Override
          public void visibleAreaChanged(VisibleAreaEvent e) {
            Editor editor1 = getEditor1();
            if (editor1 != null) {
              editor1.getComponent().repaint();
            }
            Editor editor2 = getEditor2();
            if (editor2 != null) {
              editor2.getComponent().repaint();
            }
          }
        };
    registerActions();
  }