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

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


  private RangeDifference findConsistentRangeAfterLeft(int line, int size) {
    RangeDifference found= null;

    for (ListIterator it= fDifferences.listIterator(fDifferences.size()); it.hasPrevious();) {
      RangeDifference difference= (RangeDifference) it.previous();
      if (found == null || difference.kind() == RangeDifference.NOCHANGE
          && (difference.leftStart() > line && difference.leftLength() >= size
              || difference.leftStart() <= line && difference.leftEnd() - line >= size))
        found= difference;

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


    int unchanged= -1; // the number of unchanged lines before line
    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;
      }
View Full Code Here

    int unchanged= -1; // the number of unchanged lines after line
    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;
      }
View Full Code Here

    final List differences= fDifferences;
    synchronized (differences) {
      for (Iterator it= differences.iterator(); it.hasNext();) {
        diff= (RangeDifference) it.next();
        if (line >= diff.rightStart() && line < diff.rightEnd()) {
          if (diff.kind() == RangeDifference.NOCHANGE && it.hasNext())
            diff= (RangeDifference) it.next();
          break;
        }
      }
    }
View Full Code Here

    }

    // optimize unchanged blocks: if the consistent blocks around the change are larger than
    // size, we redimension them (especially important when there are only few changes.
    int shiftBefore= 0;
    if (consistentBefore.kind() == RangeDifference.NOCHANGE) {
      int unchanged;
      if (leftToRight)
        unchanged= Math.min(fFirstLine, consistentBefore.leftEnd()) - consistentBefore.leftStart();
      else
        unchanged=  Math.min(fFirstLine, consistentBefore.rightEnd()) - consistentBefore.rightStart();
View Full Code Here

    }

    // undo optimization shifting
    if (shiftBefore > 0) {
      RangeDifference first= (RangeDifference) diffs.get(0);
      if (first.kind() == RangeDifference.NOCHANGE)
        first.extendStart(-shiftBefore);
      else
        diffs.add(0, new RangeDifference(RangeDifference.NOCHANGE, first.rightStart() - shiftBefore, shiftBefore, first.leftStart() - shiftBefore, shiftBefore));
    }
View Full Code Here

        diffs.add(0, new RangeDifference(RangeDifference.NOCHANGE, first.rightStart() - shiftBefore, shiftBefore, first.leftStart() - shiftBefore, shiftBefore));
    }

    RangeDifference last= (RangeDifference) diffs.get(diffs.size() - 1);
    if (shiftAfter > 0) {
      if (last.kind() == RangeDifference.NOCHANGE)
        last.extendEnd(shiftAfter);
      else
        diffs.add(new RangeDifference(RangeDifference.NOCHANGE, last.rightEnd(), shiftAfter , last.leftEnd(), shiftAfter));
    }
View Full Code Here

  private RangeDifference findConsistentRangeBeforeLeft(int line, int size) {
    RangeDifference found= null;

    for (ListIterator it= fDifferences.listIterator(); it.hasNext();) {
      RangeDifference difference= (RangeDifference) it.next();
      if (found == null || difference.kind() == RangeDifference.NOCHANGE
          && (difference.leftEnd() < line && difference.leftLength() >= size
              || difference.leftEnd() >= line && line - difference.leftStart() >= size))
        found= difference;

      if (difference.leftEnd() >= line)
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.