Package at.ssw.coco.ide.editor

Examples of at.ssw.coco.ide.editor.ATGPresentationReconciler


   */
  public TextPresentation createPresentation(
      TreeSet<HighlightedPosition> addedPositions,
      List<HighlightedPosition> removedPositions) {
    SourceViewer sourceViewer = fSourceViewer;
    ATGPresentationReconciler presentationReconciler = fPresentationReconciler;
    if (sourceViewer == null || presentationReconciler == null) {
      return null;
    }

    if (isCanceled()) {
      return null;
    }

    IDocument document = sourceViewer.getDocument();
    if (document == null) {
      return null;
    }

    int minStart = Integer.MAX_VALUE;
    int maxEnd = Integer.MIN_VALUE;

    for (HighlightedPosition h : removedPositions) {
      int offset = h.getOffset();
      minStart = Math.min(minStart, offset);
      maxEnd = Math.max(maxEnd, offset + h.getLength());
    }

    for (HighlightedPosition h : addedPositions) {
      int offset = h.getOffset();
      minStart = Math.min(minStart, offset);
      maxEnd = Math.max(maxEnd, offset + h.getLength());
    }

    if (minStart < maxEnd) {
      try {
        minStart = Math.min(minStart, document.getLength());
        maxEnd = Math.min(maxEnd, document.getLength());
        synchronized (getLockObject(document)) {
          return presentationReconciler.createRepairDescription(
              new Region(minStart, maxEnd - minStart), document);
        }
      } catch (RuntimeException e) {
        // concurrent modification from UI thread
      }
View Full Code Here

TOP

Related Classes of at.ssw.coco.ide.editor.ATGPresentationReconciler

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.