Package org.eclipse.compare.internal.merge.DocumentMerger

Examples of org.eclipse.compare.internal.merge.DocumentMerger.Diff


    // return;

    if (fCenterButton != null && !fCenterButton.isDisposed())
      fCenterButton.setVisible(false);

    Diff oldDiff = fCurrentDiff;

    if (d != null && revealAndSelect) {

      // before we set fCurrentDiff we change the selection
      // so that the paint code uses the old background colors
      // otherwise selection isn't drawn correctly
      if (d.isToken() || !fHighlightTokenChanges || deep
          || !d.hasChildren()) {
        if (isThreeWay() && !isIgnoreAncestor())
          fAncestor.setSelection(d.getPosition(ANCESTOR_CONTRIBUTOR));
        fLeft.setSelection(d.getPosition(LEFT_CONTRIBUTOR));
        fRight.setSelection(d.getPosition(RIGHT_CONTRIBUTOR));
      } else {
        if (isThreeWay() && !isIgnoreAncestor())
          fAncestor.setSelection(new Position(d
              .getPosition(ANCESTOR_CONTRIBUTOR).offset, 0));
        fLeft.setSelection(new Position(
            d.getPosition(LEFT_CONTRIBUTOR).offset, 0));
        fRight.setSelection(new Position(d
            .getPosition(RIGHT_CONTRIBUTOR).offset, 0));
      }

      // now switch diffs
      fCurrentDiff = d;
      revealDiff(d, d.isToken());
    } else {
      fCurrentDiff = d;
    }

    Diff d1 = oldDiff != null ? oldDiff.getParent() : null;
    Diff d2 = fCurrentDiff != null ? fCurrentDiff.getParent() : null;
    if (d1 != d2) {
      updateDiffBackground(d1);
      updateDiffBackground(d2);
    }
View Full Code Here


        allButThis = fAncestor;
      } else {
        int vpos = 0;
        for (Iterator iterator = fMerger.rangesIterator(); iterator
            .hasNext();) {
          Diff diff = (Diff) iterator.next();
          if (diff == d)
            break;
          if (fSynchronizedScrolling) {
            vpos += diff.getMaxDiffHeight();
          } else {
            avpos += diff.getAncestorHeight();
            lvpos += diff.getLeftHeight();
            rvpos += diff.getRightHeight();
          }
        }
        if (fSynchronizedScrolling)
          avpos = lvpos = rvpos = vpos;
        int delta = fRight.getViewportLines() / 4;
View Full Code Here

          : fLeft.getRewriteTarget();
      boolean compoundChangeStarted = false;
      try {
        for (Iterator iterator = fMerger.changesIterator(); iterator
            .hasNext();) {
          Diff diff = (Diff) iterator.next();
          switch (diff.getKind()) {
          case RangeDifference.LEFT:
            if (leftToRight) {
              if (!compoundChangeStarted) {
                target.beginCompoundChange();
                compoundChangeStarted = true;
View Full Code Here

    public void selectionChanged(SelectionChangedEvent event) {
      ISelection s = event.getSelection();
      if (s instanceof IStructuredSelection) {
        IStructuredSelection ss = (IStructuredSelection) s;
        Object element = ss.getFirstElement();
        Diff diff = findDiff(element);
        if (diff != null)
          setCurrentDiff(diff, true);
      }
    }
View Full Code Here

    }

    private Diff findDiff(Position p, boolean left) {
      for (Iterator iterator = fMerger.rangesIterator(); iterator
          .hasNext();) {
        Diff diff = (Diff) iterator.next();
        Position diffPos;
        if (left) {
          diffPos = diff.getPosition(LEFT_CONTRIBUTOR);
        } else {
          diffPos = diff.getPosition(RIGHT_CONTRIBUTOR);
        }
        // If the element falls within a diff, highlight that diff
        if (diffPos.offset + diffPos.length >= p.offset
            && diff.getKind() != RangeDifference.NOCHANGE)
          return diff;
        // Otherwise, highlight the first diff after the elements
        // position
        if (diffPos.offset >= p.offset)
          return diff;
View Full Code Here

      if (!fHighlightTokenChanges)
        return;
      IRegion region = textPresentation.getExtent();
      Diff[] changeDiffs = fMerger.getChangeDiffs(getLeg(viewer), region);
      for (int i = 0; i < changeDiffs.length; i++) {
        Diff diff = changeDiffs[i];
        StyleRange range = getStyleRange(diff, region);
        if (range != null)
          textPresentation.mergeStyleRange(range);
      }
    }
View Full Code Here

      private Cursor fLastCursor;

      public void mouseMove(MouseEvent e) {
        Cursor cursor = null;
        Diff diff = handlemouseInBirdsEyeView(fBirdsEyeCanvas, e.y);
        if (diff != null && diff.getKind() != RangeDifference.NOCHANGE)
          cursor = fBirdsEyeCursor;
        if (fLastCursor != cursor) {
          fBirdsEyeCanvas.setCursor(cursor);
          fLastCursor = cursor;
        }
View Full Code Here

      Point region = new Point(0, 0);
      char leg = getLeg(tp);
      for (Iterator iterator = fMerger.changesIterator(); iterator
          .hasNext();) {
        Diff diff = (Diff) iterator.next();
        if (diff.isDeleted())
          continue;

        if (fShowCurrentOnly2 && !isCurrentDiff(diff))
          continue;

        tp.getLineRange(diff.getPosition(leg), region);
        int y = (region.x * lineHeight) + shift;
        int h = region.y * lineHeight;

        if (y + h < 0)
          continue;
View Full Code Here

      Point region = new Point(0, 0);

      for (Iterator iterator = fMerger.changesIterator(); iterator
          .hasNext();) {
        Diff diff = (Diff) iterator.next();
        if (diff.isDeleted())
          continue;

        if (fShowCurrentOnly2 && !isCurrentDiff(diff))
          continue;

        fLeft.getLineRange(diff.getPosition(LEFT_CONTRIBUTOR), region);
        int ly = (region.x * lineHeight) + lshift;
        int lh = region.y * lineHeight;

        fRight.getLineRange(diff.getPosition(RIGHT_CONTRIBUTOR), region);
        int ry = (region.x * lineHeight) + rshift;
        int rh = region.y * lineHeight;

        if (Math.max(ly + lh, ry + rh) < 0)
          continue;
View Full Code Here

      return;

    Display display = canvas.getDisplay();
    int y = 0;
    for (Iterator iterator = fMerger.rangesIterator(); iterator.hasNext();) {
      Diff diff = (Diff) iterator.next();
      int h = fSynchronizedScrolling ? diff.getMaxDiffHeight() : diff
          .getRightHeight();

      if (fMerger.useChange(diff)) {

        yy = (y * size.y) / virtualHeight;
View Full Code Here

TOP

Related Classes of org.eclipse.compare.internal.merge.DocumentMerger.Diff

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.