Package org.eclipse.jface.text.reconciler

Examples of org.eclipse.jface.text.reconciler.DirtyRegion


    // queue a full revalidation of content
    IDocument document = getDocumentProvider().getDocument(getEditorInput());
    SourceViewerConfiguration sourceViewerConfiguration = getSourceViewerConfiguration();
    if (document != null && sourceViewerConfiguration != null && sourceViewerConfiguration.getReconciler(getSourceViewer()) instanceof DirtyRegionProcessor) {
      ((DirtyRegionProcessor) sourceViewerConfiguration.getReconciler(getSourceViewer())).processDirtyRegion(new DirtyRegion(0, document.getLength(), DirtyRegion.INSERT, document.get()));
    }

    /*
     * https://bugs.eclipse.org/bugs/show_bug.cgi?id=129906 - update
     * selection to listeners
View Full Code Here


   * @see org.eclipse.wst.sse.ui.internal.reconcile.DirtyRegionProcessor#getOuterRegion(org.eclipse.jface.text.reconciler.DirtyRegion,
   *      org.eclipse.jface.text.reconciler.DirtyRegion)
   */
  protected DirtyRegion getOuterRegion(DirtyRegion root, DirtyRegion possible) {
    // first try simple region check if one region contains the other
    DirtyRegion outer = super.getOuterRegion(root, possible);
    if (outer == null && fCurrentDoc != null) {
      IStructuredModel sModel = null;
      try {
        sModel = getStructuredModelForRead(fCurrentDoc);
        if (sModel != null) {
View Full Code Here

   * @param region1NodeStart
   * @param region2NodeStart
   * @return outer dirty region or null if none exists.
   */
  private DirtyRegion _getOuterRegion(DirtyRegion region1, DirtyRegion region2, IStructuredModel sModel, int region1NodeStart, int region2NodeStart) {
    DirtyRegion outer = null;
    int region1NodeEnd = -1;
    int region2NodeEnd = -1;
    // then check if region1's end appears after
    // region2's end
    IndexedRegion region1EndNode = sModel.getIndexedRegion(region1.getOffset() + region1.getLength());
    if (region1EndNode == null) {
      // if no end, just assume region spans all the
      // way to the end so it includes other region
      outer = region1;
    }
    else {
      region1NodeEnd = region1EndNode.getEndOffset();
      IndexedRegion region2EndNode = sModel.getIndexedRegion(region2.getOffset() + region2.getLength());
      region2NodeEnd = region2EndNode != null ? region2EndNode.getEndOffset() : getDocument().getLength();
      if (region1NodeEnd >= region2NodeEnd) {
        // root contains or is equal to possible
        outer = region1;
      }
      else if (region1NodeStart == region2NodeStart && region2NodeEnd >= region1NodeEnd) {
        // possible contains root because they
        // both start at same place but possible
        // is longer
        outer = region2;
      }
    }
    if (DEBUG) {
      if (outer != null)
        System.out.println("checking if [" + region1NodeStart + ":" + region1NodeEnd + "] contains [" + region2NodeStart + ":" + region2NodeEnd + "] ... " + outer.toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
      else
        System.out.println("checking if [" + region1NodeStart + ":" + region1NodeEnd + "] contains [" + region2NodeStart + ":" + region2NodeEnd + "] ... NO CONTAIN"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
    }
    return outer;
  }
View Full Code Here

    List dirtyRegionQueue = getDirtyRegionQueue();
    synchronized (dirtyRegionQueue) {
      for (Iterator it = dirtyRegionQueue.iterator(); it.hasNext();) {
        // go through list of existing dirty regions and check if any
        // dirty regions need to be discarded
        DirtyRegion currentExisting = (DirtyRegion) it.next();
        DirtyRegion outer = getOuterRegion(currentExisting, newDirtyRegion);
        // if we already have a request which contains the new request,
        // discard the new request
        if (outer == currentExisting)
          return;
        // if new request contains any existing requests,
View Full Code Here

   * @param possible
   * @return the outer dirty region if it contains the other dirty region,
   *         null otherwise
   */
  protected DirtyRegion getOuterRegion(DirtyRegion root, DirtyRegion possible) {
    DirtyRegion outer = null;
    if (isContained(root, possible))
      outer = root;
    else if (isContained(possible, root))
      outer = possible;
    return outer;
View Full Code Here

      return true;
    return false;
  }

  protected DirtyRegion createDirtyRegion(int offset, int length, String type) {
    DirtyRegion durty = null;
    IDocument doc = getDocument();

    if (doc != null) {
      // safety for BLE
      int docLen = doc.getLength();
      if (offset > docLen) {
        offset = docLen;
        length = 0;
      }
      else if (offset + length >= docLen)
        length = docLen - offset;
      try {
        durty = new DirtyRegion(offset, length, type, doc.get(offset, length));
      }
      catch (BadLocationException e) {
        String info = "dr: [" + offset + ":" + length + "] doc: [" + docLen + "] "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        Logger.logException(info, e);
      }
View Full Code Here

            strategy.reconcile(fLastPartitions[i]);
          }
        }
      }
      else {
        DirtyRegion entireDocument = createDirtyRegion(0, document.getLength(), DirtyRegion.INSERT);
        processDirtyRegion(entireDocument);
      }
    }
  }
View Full Code Here

      else {
        /*
         * Note that creating DirtyRegions *now* means that the wrong
         * text may be included
         */
        DirtyRegion dr = null;
        if (event.getLength() == 0) {
          /*
           * It's an insert-- we use text length though so that the
           * new region gets validated...
           */
 
View Full Code Here

          if (DEBUG) {
            Logger.log(Logger.INFO, "Rewrite session lasted " + (System.currentTimeMillis() - time0) + "ms");
            time0 = System.currentTimeMillis();
          }
          if (fReprocessAfterRewrite) {
            DirtyRegion entireDocument = createDirtyRegion(0, fDocument.getLength(), DirtyRegion.INSERT);
            processDirtyRegion(entireDocument);
          }
          if (DEBUG) {
            Logger.log(Logger.INFO, "Full document reprocess took " + (System.currentTimeMillis() - time0) + "ms");
          }
View Full Code Here

    super.process(dirtyRegion);
   
    ITypedRegion[] partitions = computePartitioning(dirtyRegion);
   
    // call the validator strategy once for each effected partition
    DirtyRegion dirty = null;
    for (int i = 0; i < partitions.length; i++) {
      dirty = createDirtyRegion(partitions[i], DirtyRegion.INSERT);

      // [source]validator (extension) for this partition
      if (getValidatorStrategy() != null) {
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.reconciler.DirtyRegion

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.