Package org.eclipse.ui.internal.texteditor.quickdiff.compare.rangedifferencer

Examples of org.eclipse.ui.internal.texteditor.quickdiff.compare.rangedifferencer.RangeDifference.rightStart()


    for (ListIterator it= fDifferences.listIterator(); it.hasNext();) {
      RangeDifference difference= (RangeDifference) it.next();
      if (found == null)
        found= difference;
      else if (difference.kind() == RangeDifference.NOCHANGE) {
        unchanged= Math.min(line, difference.rightEnd()) - difference.rightStart();
        if (unchanged >= size)
          found= difference;
      }

      if (difference.rightEnd() >= line)
View Full Code Here


    for (ListIterator it= fDifferences.listIterator(fDifferences.size()); it.hasPrevious();) {
      RangeDifference difference= (RangeDifference) it.previous();
      if (found == null)
        found= difference;
      else if (difference.kind() == RangeDifference.NOCHANGE) {
        unchanged= difference.rightEnd() - Math.max(line + 1, difference.rightStart()); // + 1 to step over the changed line
        if (unchanged >= size)
          found= difference;
      }

      if (difference.rightStart() <= line)
View Full Code Here

        unchanged= difference.rightEnd() - Math.max(line + 1, difference.rightStart()); // + 1 to step over the changed line
        if (unchanged >= size)
          found= difference;
      }

      if (difference.rightStart() <= line)
        break;
    }

    return found;
  }
View Full Code Here

   */
  private int getLeftLine(int rightLine) {
    RangeDifference d= getRangeDifferenceForRightLine(rightLine);
    if (d == null)
      return -1;
    return Math.min(d.leftEnd() - 1, d.leftStart() + rightLine - d.rightStart());
  }

  /**
   * Gets the corresponding line on the right side for a line on the left.
   *
 
View Full Code Here

   */
  private int getRightLine(int leftLine) {
    RangeDifference d= getRangeDifferenceForLeftLine(leftLine);
    if (d == null)
      return -1;
    return Math.min(d.rightEnd() - 1, d.rightStart() + leftLine - d.leftStart());
  }

  /**
   * Gets the RangeDifference for a line on the left hand side.
   *
 
View Full Code Here

  private RangeDifference getRangeDifferenceForRightLine(int rightLine) {
    final List differences= fDifferences;
    synchronized (differences) {
      for (Iterator it= differences.iterator(); it.hasNext();) {
        RangeDifference d= (RangeDifference) it.next();
        if (rightLine >= d.rightStart() && rightLine < d.rightEnd()) {
          return d;
        }
      }
    }
    return null;
View Full Code Here

   */
  public Position getPosition(Annotation annotation) {
    if (fRightDocument != null && annotation instanceof DiffRegion) {
      RangeDifference difference= ((DiffRegion)annotation).getDifference();
      try {
        int offset= fRightDocument.getLineOffset(difference.rightStart());
        return new Position(offset, fRightDocument.getLineOffset(difference.rightEnd() - 1) + fRightDocument.getLineLength(difference.rightEnd() - 1) - offset);
      } catch (BadLocationException e) {
        // ignore and return null;
      }
    }
View Full Code Here

    if (isSuspended())
      return fLineChangeInfo;

    // try cache first / speeds up linear search
    RangeDifference last= fLastDifference;
    if (last != null && last.rightStart() <= line && last.rightEnd() > line)
      return new DiffRegion(last, line - last.rightStart(), fDifferences, fLeftDocument);

    fLastDifference= getRangeDifferenceForRightLine(line);
    last= fLastDifference;
    if (last != null)
View Full Code Here

      return fLineChangeInfo;

    // try cache first / speeds up linear search
    RangeDifference last= fLastDifference;
    if (last != null && last.rightStart() <= line && last.rightEnd() > line)
      return new DiffRegion(last, line - last.rightStart(), fDifferences, fLeftDocument);

    fLastDifference= getRangeDifferenceForRightLine(line);
    last= fLastDifference;
    if (last != null)
      return new DiffRegion(last, line - last.rightStart(), fDifferences, fLeftDocument);
View Full Code Here

      return new DiffRegion(last, line - last.rightStart(), fDifferences, fLeftDocument);

    fLastDifference= getRangeDifferenceForRightLine(line);
    last= fLastDifference;
    if (last != null)
      return new DiffRegion(last, line - last.rightStart(), fDifferences, fLeftDocument);

    return null;
  }

  /*
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.