public Resizer(Control c, int dir) {
   fDirection = dir;
   fControl = c;
   fLiveResize = !(fControl instanceof Sash);
   updateCursor(c, dir);
   fControl.addMouseListener(this);
   fControl.addMouseMoveListener(this);
   fControl.addDisposeListener(
       new DisposeListener() {
         public void widgetDisposed(DisposeEvent e) {
           fControl = null;
         }
       });
 }
 void updateCursor(Control c, int dir) {
   if (!(c instanceof Sash)) {
     Cursor cursor = null;
     switch (dir) {
       case VERTICAL:
         if (fAncestorVisible) {
           if (fVSashCursor == null) fVSashCursor = new Cursor(c.getDisplay(), SWT.CURSOR_SIZENS);
           cursor = fVSashCursor;
         } else {
           if (fNormalCursor == null) fNormalCursor = new Cursor(c.getDisplay(), SWT.CURSOR_ARROW);
           cursor = fNormalCursor;
         }
         break;
       case HORIZONTAL:
         if (fHSashCursor == null) fHSashCursor = new Cursor(c.getDisplay(), SWT.CURSOR_SIZEWE);
         cursor = fHSashCursor;
         break;
       case VERTICAL + HORIZONTAL:
         if (fAncestorVisible) {
           if (fHVSashCursor == null)
             fHVSashCursor = new Cursor(c.getDisplay(), SWT.CURSOR_SIZEALL);
           cursor = fHVSashCursor;
         } else {
           if (fHSashCursor == null) fHSashCursor = new Cursor(c.getDisplay(), SWT.CURSOR_SIZEWE);
           cursor = fHSashCursor;
         }
         break;
     }
     if (cursor != null) c.setCursor(cursor);
   }
 }
    public void mouseDown(MouseEvent e) {
      Composite parent = fControl.getParent();

      Point s = parent.getSize();
      Point as = fAncestorLabel.getSize();
      Point ys = fLeftLabel.getSize();
      Point ms = fRightLabel.getSize();

      fWidth1 = ys.x;
      fWidth2 = ms.x;
      fHeight1 = fLeftLabel.getLocation().y - as.y;
      fHeight2 = s.y - (fLeftLabel.getLocation().y + ys.y);

      fX = e.x;
      fY = e.y;
      fIsDown = true;
    }
  /**
   * Builds the SWT controls for the three areas of a compare/merge viewer.
   *
   * <p>Calls the hooks <code>createControls</code> and <code>createToolItems</code> to let
   * subclasses build the specific content areas and to add items to an enclosing toolbar.
   *
   * <p>This method must only be called in the constructor of subclasses.
   *
   * @param parent the parent control
   * @return the new control
   */
  protected final Control buildControl(Composite parent) {

    fComposite =
        new Composite(parent, fStyles | SWT.LEFT_TO_RIGHT) { // we
          // force
          // a
          // specific
          // direction
          public boolean setFocus() {
            return ContentMergeViewer.this.handleSetFocus();
          }
        };
    fComposite.setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle());

    hookControl(fComposite); // hook help & dispose listener

    fComposite.setLayout(new ContentMergeViewerLayout());

    int style = SWT.SHADOW_OUT;
    fAncestorLabel = new CLabel(fComposite, style | Window.getDefaultOrientation());

    fLeftLabel = new CLabel(fComposite, style | Window.getDefaultOrientation());
    new Resizer(fLeftLabel, VERTICAL);

    fDirectionLabel = new CLabel(fComposite, style);
    fDirectionLabel.setAlignment(SWT.CENTER);
    new Resizer(fDirectionLabel, HORIZONTAL | VERTICAL);

    fRightLabel = new CLabel(fComposite, style | Window.getDefaultOrientation());
    new Resizer(fRightLabel, VERTICAL);

    if (fCenter == null || fCenter.isDisposed()) fCenter = createCenterControl(fComposite);

    createControls(fComposite);

    fHandlerService =
        CompareHandlerService.createFor(
            getCompareConfiguration().getContainer(), fComposite.getShell());

    initializeToolbars(parent);

    return fComposite;
  }
    private void resize(MouseEvent e) {
      int dx = e.x - fX;
      int dy = e.y - fY;

      int centerWidth = fCenter.getSize().x;

      if (fWidth1 + dx > centerWidth && fWidth2 - dx > centerWidth) {
        fWidth1 += dx;
        fWidth2 -= dx;
        if ((fDirection & HORIZONTAL) != 0)
          fHSplit = (double) fWidth1 / (double) (fWidth1 + fWidth2);
      }
      if (fHeight1 + dy > centerWidth && fHeight2 - dy > centerWidth) {
        fHeight1 += dy;
        fHeight2 -= dy;
        if ((fDirection & VERTICAL) != 0)
          fVSplit = (double) fHeight1 / (double) (fHeight1 + fHeight2);
      }

      fComposite.layout(true);
      fControl.getDisplay().update();
    }