Examples of IndexedRegion


Examples of org.eclipse.wst.sse.core.internal.provisional.IndexedRegion

  }

  private Node getCurrentNode(IStructuredModel model, int offset) {
    // get the current node at the offset (returns either: element,
    // doctype, text)
    IndexedRegion inode = null;
    if (model != null) {
      inode = model.getIndexedRegion(offset);
      if (inode == null) {
        inode = model.getIndexedRegion(offset - 1);
      }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IndexedRegion

   *         implementors of IndexedRegion
   */
  public Object[] getElements(IStructuredModel model, int start, int end) {
    Object[] localSelectedStructures = null;
    if (model != null) {
      IndexedRegion region = model.getIndexedRegion(start);
      if (region != null) {
        if (end <= region.getEndOffset()) {
          // single selection
          localSelectedStructures = new Object[1];
          localSelectedStructures[0] = region;
        }
        else {
          // multiple selection
          int maxLength = model.getStructuredDocument().getLength();
          List structures = new ArrayList(2);
          while (region != null && region.getEndOffset() <= end && region.getEndOffset() < maxLength) {
            structures.add(region);
            region = model.getIndexedRegion(region.getEndOffset() + 1);
          }
          localSelectedStructures = structures.toArray();
        }
      }
    }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IndexedRegion

      IStructuredModel sModel = null;
      try {
        sModel = getStructuredModelForRead(fCurrentDoc);
        if (sModel != null) {
          // now compare nodes
          IndexedRegion rootRegion = sModel.getIndexedRegion(root.getOffset());
          IndexedRegion possRegion = sModel.getIndexedRegion(possible.getOffset());
          if (rootRegion != null && possRegion != null) {
            int rootStart = rootRegion.getStartOffset();
            int possStart = possRegion.getStartOffset();
            // first just check if rootregion starts before
            // possregion
            if (rootStart <= possStart) {
              // check if possregion is inside rootregion
              outer = _getOuterRegion(root, possible, sModel, rootStart, possStart);
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IndexedRegion

    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) {
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IndexedRegion

       
        // use structured model to determine area to process
        if (sModel != null) {
          int start = dirtyRegion.getOffset();
          int end = start + dirtyRegion.getLength();
          IndexedRegion irStart = sModel.getIndexedRegion(start);
          IndexedRegion irEnd = sModel.getIndexedRegion(end);

          if (irStart != null) {
            start = Math.min(start, irStart.getStartOffset());
          }
          if (irEnd != null) {
            end = Math.max(end, irEnd.getEndOffset());
          }
          super.process(createDirtyRegion(start, end - start, DirtyRegion.INSERT));
        } else {
          super.process(dirtyRegion);
        }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IndexedRegion

  protected boolean overlaps(Position pos, IStructuredDocumentRegion[] sdRegions) {
    int start = -1;
    int end = -1;
    for (int i = 0; i < sdRegions.length; i++) {
        if(!sdRegions[i].isDeleted()) {
          IndexedRegion corresponding = getCorrespondingNode(sdRegions[i]);
                if(corresponding != null) {
              if (start == -1 || start > corresponding.getStartOffset())
                start = corresponding.getStartOffset();
              if (end == -1 || end < corresponding.getEndOffset())
                end = corresponding.getEndOffset();
                }
            }
    }
    return pos.overlapsWith(start, end - start);
  }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IndexedRegion

   * @param sdRegion
   * @return the corresponding node for sdRegion
   */
  protected IndexedRegion getCorrespondingNode(IStructuredDocumentRegion sdRegion) {
    IStructuredModel sModel = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
        IndexedRegion indexedRegion = null;
        try {
            if (sModel != null)
                indexedRegion = sModel.getIndexedRegion(sdRegion.getStart());   
        } finally {
            if (sModel != null)
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IndexedRegion

    }
    unloadPreferences();
  }

  private void processDirective(IReporter reporter, IFile file, IStructuredModel model, IStructuredDocumentRegion documentRegion) {
    IndexedRegion ir = model.getIndexedRegion(documentRegion.getStartOffset());
    if (ir instanceof IDOMElement) {
      IDOMElement element = (IDOMElement) ir;
      ModelQuery query = ModelQueryUtil.getModelQuery(model);
      if (query != null) {
        CMElementDeclaration cmElement = query.getCMElementDeclaration(element);
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IndexedRegion

          markInvalidAnnotationsForDeletion(dirtyRegion, deletions);
         
          //reconcile each effected indexed region
          Iterator indexedRegionsIter = indexedRegions.iterator();
          while(indexedRegionsIter.hasNext() && fProjectionAnnotationModel != null) {
            IndexedRegion indexedRegion = (IndexedRegion)indexedRegionsIter.next();
         
            //only try to create an annotation if the index region is a valid type
            if(indexedRegionValidType(indexedRegion)) {
              FoldingAnnotation annotation = new FoldingAnnotation(indexedRegion, false);
             
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IndexedRegion

    //for each text region in each structured document region find the indexed region it spans/is in
    for (int structRegionIndex = 0; structRegionIndex < structRegions.length && fProjectionAnnotationModel != null; ++structRegionIndex) {
      IStructuredDocumentRegion structuredDocumentRegion = structRegions[structRegionIndex];
     
      int offset = structuredDocumentRegion.getStartOffset();
      IndexedRegion indexedRegion = model.getIndexedRegion(offset);
      indexedRegions.add(indexedRegion);
      if (structuredDocumentRegion.getEndOffset() <= indexedRegion.getEndOffset())
        continue;

      ITextRegionList textRegions = structuredDocumentRegion.getRegions();
      int textRegionCount = textRegions.size();
      for (int textRegionIndex = 1; textRegionIndex < textRegionCount; ++textRegionIndex) {
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.