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

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


    return super.createCenterControl(parent);
  }

  private boolean handleMouseMoveOverCenter(Canvas canvas, int x, int y) {
    Rectangle r = new Rectangle(0, 0, 0, 0);
    Diff diff = getDiffUnderMouse(canvas, x, y, r);
    if (diff != null && !diff.isUnresolvedIncomingOrConflicting())
      diff = null;
    if (diff != fButtonDiff) {
      if (diff != null) {
        if (fLeft.isEditable()) {
          fButtonDiff = diff;
View Full Code Here


              && Utilities.getAdapter(right, IHunk.class) != null)
            fLeft.setTopIndex(getHunkStart());
          else
            fRight.setTopIndex(getHunkStart());
        } else {
          Diff selectDiff = null;
          if (FIX_47640) {
            if (leftRange != null)
              selectDiff = fMerger.findDiff(LEFT_CONTRIBUTOR,
                  leftRange);
            else if (rightRange != null)
View Full Code Here

  private void updateAllDiffBackgrounds(Display display) {
    if (fMerger.hasChanges()) {
      boolean threeWay = isThreeWay();
      for (Iterator iterator = fMerger.changesIterator(); iterator
          .hasNext();) {
        Diff diff = (Diff) iterator.next();
        Color c = getColor(display, getFillColor(diff));
        if (threeWay)
          fAncestor.setLineBackground(
              diff.getPosition(ANCESTOR_CONTRIBUTOR), c);
        fLeft.setLineBackground(diff.getPosition(LEFT_CONTRIBUTOR), c);
        fRight.setLineBackground(diff.getPosition(RIGHT_CONTRIBUTOR), c);
      }
    }
  }
View Full Code Here

    }

    if (other instanceof IDocumentRange) {
      IDocumentRange dr = (IDocumentRange) other;
      Position p = dr.getRange();
      Diff diff = findDiff(otherType, p.offset);
      return fMerger.findInsertionPoint(diff, type);
    }
    return 0;
  }
View Full Code Here

  /*
   * Track selection changes to update the current Diff.
   */
  private void handleSelectionChanged(MergeSourceViewer tw) {
    Point p = tw.getSelectedRange();
    Diff d = findDiff(tw, p.x, p.x + p.y);
    updateStatus(d);
    setCurrentDiff(d, false); // don't select or reveal
  }
View Full Code Here

    }

    if (fMerger.hasChanges()) {
      for (Iterator iterator = fMerger.changesIterator(); iterator
          .hasNext();) {
        Diff diff = (Diff) iterator.next();
        updateDiffBackground(diff);
      }
    }
    invalidateTextPresentation();
  }
View Full Code Here

      int unresolvedConflicting = 0;

      if (fMerger.hasChanges()) {
        for (Iterator iterator = fMerger.changesIterator(); iterator
            .hasNext();) {
          Diff d = (Diff) iterator.next();
          if (d.isIncomingOrConflicting() /*
                           * &&
                           * useChange(d.fDirection)
                           * && !d.fIsWhitespace
                           */) {
            incomingOrConflicting++;
            if (!d.isResolved()) {
              if (d.getKind() == RangeDifference.CONFLICT) {
                unresolvedConflicting++;
                break; // we can stop here because a conflict
                    // has the maximum priority
              }
              unresolvedIncoming++;
View Full Code Here

    // find the diff's number
    int diffNumber = 0;
    if (fMerger.hasChanges()) {
      for (Iterator iterator = fMerger.changesIterator(); iterator
          .hasNext();) {
        Diff d = (Diff) iterator.next();
        diffNumber++;
        if (d == diff)
          break;
      }
    }
View Full Code Here

    }
    if (fLeft.getDocument() == null || fRight.getDocument() == null) {
      return;
    }

    Diff firstDiff = null;
    if (first)
      firstDiff = findNext(fRight, -1, -1, false);
    else
      firstDiff = findPrev(fRight, 9999999, 9999999, false);
    setCurrentDiff(firstDiff, true);
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 * lineHeightLeft) + lshift;
        int lh = region.y * lineHeightLeft;

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

        if (Math.max(ly + lh, ry + rh) < 0)
          continue;
        if (Math.min(ly, ry) >= visibleHeight)
          break;

        fPts[0] = x;
        fPts[1] = ly;
        fPts[2] = w;
        fPts[3] = ry;
        fPts[6] = x;
        fPts[7] = ly + lh;
        fPts[4] = w;
        fPts[5] = ry + rh;

        Color fillColor = getColor(display, getFillColor(diff));
        Color strokeColor = getColor(display, getStrokeColor(diff));

        if (fUseSingleLine) {
          int w2 = 3;

          g.setBackground(fillColor);
          g.fillRectangle(0, ly, w2, lh); // left
          g.fillRectangle(w - w2, ry, w2, rh); // right

          g.setLineWidth(0 /* LW */);
          g.setForeground(strokeColor);
          g.drawRectangle(0 - 1, ly, w2, lh); // left
          g.drawRectangle(w - w2, ry, w2, rh); // right

          if (fUseSplines) {
            int[] points = getCenterCurvePoints(w2, ly + lh / 2, w
                - w2, ry + rh / 2);
            for (int i = 1; i < points.length; i++)
              g.drawLine(w2 + i - 1, points[i - 1], w2 + i,
                  points[i]);
          } else {
            g.drawLine(w2, ly + lh / 2, w - w2, ry + rh / 2);
          }
        } else {
          // two lines
          if (fUseSplines) {
            g.setBackground(fillColor);

            g.setLineWidth(0 /* LW */);
            g.setForeground(strokeColor);

            int[] topPoints = getCenterCurvePoints(fPts[0],
                fPts[1], fPts[2], fPts[3]);
            int[] bottomPoints = getCenterCurvePoints(fPts[6],
                fPts[7], fPts[4], fPts[5]);
            g.setForeground(fillColor);
            g.drawLine(0, bottomPoints[0], 0, topPoints[0]);
            for (int i = 1; i < bottomPoints.length; i++) {
              g.setForeground(fillColor);
              g.drawLine(i, bottomPoints[i], i, topPoints[i]);
              g.setForeground(strokeColor);
              g.drawLine(i - 1, topPoints[i - 1], i, topPoints[i]);
              g.drawLine(i - 1, bottomPoints[i - 1], i,
                  bottomPoints[i]);
            }
          } else {
            g.setBackground(fillColor);
            g.fillPolygon(fPts);

            g.setLineWidth(0 /* LW */);
            g.setForeground(strokeColor);
            g.drawLine(fPts[0], fPts[1], fPts[2], fPts[3]);
            g.drawLine(fPts[6], fPts[7], fPts[4], fPts[5]);
          }
        }

        if (fUseSingleLine && showResolveUI
            && diff.isUnresolvedIncomingOrConflicting()) {
          // draw resolve state
          int cx = (w - RESOLVE_SIZE) / 2;
          int cy = ((ly + lh / 2) + (ry + rh / 2) - RESOLVE_SIZE) / 2;

          g.setBackground(fillColor);
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.