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

Examples of org.eclipse.ui.internal.texteditor.quickdiff.compare.equivalence.DocumentEquivalenceClass


            }
          } while (true);
        }

        IHashFunction hash= new DJBHashFunction();
        DocumentEquivalenceClass leftEquivalent= new DocumentEquivalenceClass(reference, hash);
        fLeftEquivalent= leftEquivalent;
        IRangeComparator ref= new DocEquivalenceComparator(leftEquivalent, null);
       
        DocumentEquivalenceClass rightEquivalent= new DocumentEquivalenceClass(actual, hash);
        fRightEquivalent= rightEquivalent;
        IRangeComparator act= new DocEquivalenceComparator(rightEquivalent, null);
        List diffs= RangeDifferencer.findRanges(monitor, ref, act);
        // 7:  Reset the model to the just gotten differences
        //     re-inject stored events to get up to date.
        synchronized (DocumentLineDiffer.this) {
          if (isCanceled(monitor))
            return Status.CANCEL_STATUS;

          // set the new differences so we can operate on them
          fDifferences= diffs;
        }

        // re-inject events accumulated in the meantime.
        try {
          do {
            DocumentEvent event;
            synchronized (DocumentLineDiffer.this) {
              if (isCanceled(monitor))
                return Status.CANCEL_STATUS;

              if (fStoredEvents.isEmpty()) {
                // we are back in sync with the life documents
                fInitializationJob= null;
                fState= SYNCHRONIZED;
                fLastDifference= null;

                // replace the private documents with the actual
                leftEquivalent.setDocument(left);
                rightEquivalent.setDocument(right);

                break;
              }

              event= (DocumentEvent) fStoredEvents.remove(0);
View Full Code Here


  void handleAboutToBeChanged(DocumentEvent event) throws BadLocationException {
    Assert.isTrue(fThread == null);
    fThread= Thread.currentThread();
   
    IDocument doc= event.getDocument();
    DocumentEquivalenceClass rightEquivalent= fRightEquivalent;

    if (doc == null || rightEquivalent == null)
      return;

    // store size of replaced region (never synchronized -> not a problem)
    fFirstLine= doc.getLineOfOffset(event.getOffset()); // store change bounding lines
    fNLines= doc.getLineOfOffset(event.getOffset() + event.getLength()) - fFirstLine + 1;
    rightEquivalent.update(event);
  }
View Full Code Here

    Assert.isTrue(fThread == Thread.currentThread());
    fThread= null;
   
    // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=132125
    IDocument left= fLeftDocument;
    DocumentEquivalenceClass leftEquivalent= fLeftEquivalent;
    DocumentEquivalenceClass rightEquivalent= fRightEquivalent;
    if (left == null || leftEquivalent == null || rightEquivalent == null)
      return;
   
    // documents: left, right; modified and unchanged are either of both
    IDocument right= event.getDocument(); // TODO two-side
View Full Code Here

            }
          } while (true);
        }

        IHashFunction hash= new DJBHashFunction();
        DocumentEquivalenceClass leftEquivalent= new DocumentEquivalenceClass(reference, hash);
        fLeftEquivalent= leftEquivalent;
        IRangeComparator ref= new DocEquivalenceComparator(leftEquivalent, null);

        DocumentEquivalenceClass rightEquivalent= new DocumentEquivalenceClass(actual, hash);
        fRightEquivalent= rightEquivalent;
        IRangeComparator act= new DocEquivalenceComparator(rightEquivalent, null);
        List diffs= new ArrayList(Arrays.asList(RangeDifferencer.findRanges(fRangeDiffFactory, monitor, ref, act)));
        // 7:  Reset the model to the just gotten differences
        //     re-inject stored events to get up to date.
        synchronized (DocumentLineDiffer.this) {
          if (isCanceled(monitor))
            return Status.CANCEL_STATUS;

          // set the new differences so we can operate on them
          fDifferences= diffs;
        }

        // re-inject events accumulated in the meantime.
        try {
          do {
            DocumentEvent event;
            synchronized (DocumentLineDiffer.this) {
              if (isCanceled(monitor))
                return Status.CANCEL_STATUS;

              if (fStoredEvents.isEmpty()) {
                // we are back in sync with the life documents
                fInitializationJob= null;
                fState= SYNCHRONIZED;
                fLastDifference= null;

                // replace the private documents with the actual
                leftEquivalent.setDocument(left);
                rightEquivalent.setDocument(right);

                break;
              }

              event= (DocumentEvent) fStoredEvents.remove(0);
View Full Code Here

  void handleAboutToBeChanged(DocumentEvent event) throws BadLocationException {
    Assert.isTrue(fThread == null);
    fThread= Thread.currentThread();

    IDocument doc= event.getDocument();
    DocumentEquivalenceClass rightEquivalent= fRightEquivalent;

    if (doc == null || rightEquivalent == null)
      return;

    // store size of replaced region (never synchronized -> not a problem)
    fFirstLine= doc.getLineOfOffset(event.getOffset()); // store change bounding lines
    fNLines= doc.getLineOfOffset(event.getOffset() + event.getLength()) - fFirstLine + 1;
    rightEquivalent.update(event);
  }
View Full Code Here

    Assert.isTrue(fThread == null || fThread == Thread.currentThread());
    fThread= null;

    // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=132125
    IDocument left= fLeftDocument;
    DocumentEquivalenceClass leftEquivalent= fLeftEquivalent;
    DocumentEquivalenceClass rightEquivalent= fRightEquivalent;
    if (left == null || leftEquivalent == null || rightEquivalent == null)
      return;

    // documents: left, right; modified and unchanged are either of both
    IDocument right= event.getDocument(); // TODO two-side
View Full Code Here

TOP

Related Classes of org.eclipse.ui.internal.texteditor.quickdiff.compare.equivalence.DocumentEquivalenceClass

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.