Examples of ITextRegion


Examples of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion

  private ITextRegion getCompletionRegion(int documentPosition, Node domnode) {
    if (domnode == null) {
      return null;
    }

    ITextRegion region = null;
    int offset = documentPosition;
    IStructuredDocumentRegion flatNode = null;
    IDOMNode node = (IDOMNode) domnode;

    if (node.getNodeType() == Node.DOCUMENT_NODE) {
      if (node.getStructuredDocument().getLength() == 0) {
        return null;
      }
      ITextRegion result = node.getStructuredDocument()
          .getRegionAtCharacterOffset(offset)
          .getRegionAtCharacterOffset(offset);
      while (result == null) {
        offset--;
        result = node.getStructuredDocument()
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion

    if (flatNode == null) {
      return null;
    }
    Iterator regionList = flatNode.getRegions().iterator();
    while (regionList.hasNext()) {
      ITextRegion region = (ITextRegion) regionList.next();
      if (isNameRegion(region)) {
        return region;
      }
    }
    return null;
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion

    while(currRegion != null && !done) {
     
      ITextRegionList regions = currRegion.getRegions();
      for(int i = 0; i < regions.size(); ++i) {
        ITextRegion container = regions.get(i);
        if ((container instanceof ITextRegionContainer)) {
          ITextRegionList regions2 = ((ITextRegionContainer) container).getRegions();
          if (regions2 != null) {
            return true;
          }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion

      endType = DOMRegionContext.XML_TAG_CLOSE;
    }

    int startOffset = -1;
    int endOffset = -1;
    ITextRegion prevRegion = null;
    ITextRegion region;
    for (int i = 0; i < regions.size(); i++) {
      region = regions.get(i);
      String type = region.getType();
      if (type == startType) {
        startOffset = region.getEnd();
      } else if (type == endType && prevRegion != null) {
        endOffset = prevRegion.getTextEnd();
      }
      prevRegion = region;
    }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion

      return null;
    ITextRegionList regions = flatNode.getRegions();
    if (regions == null)
      return null;

    ITextRegion contentRegion = null;
    StringBuffer buffer = null;
    Iterator e = regions.iterator();
    while (e.hasNext()) {
      ITextRegion region = (ITextRegion) e.next();
      String regionType = region.getType();
      if (regionType == DOMRegionContext.XML_CDATA_OPEN || regionType == DOMRegionContext.XML_CDATA_CLOSE) {
        continue;
      }
      if (contentRegion == null) { // first content
        contentRegion = region;
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion

  public ITextRegion createToken(ITextRegionContainer parent, String context, int start, int textLength, int length) {
    return this.createToken(parent, context, start, textLength, length, null, null);
  }

  public ITextRegion createToken(ITextRegionContainer parent, String context, int start, int textLength, int length, String lang, String surroundingTag) {
    ITextRegion newRegion = createToken(context, start, textLength, length);
    // DW, 4/16/2003 token regions no longer have parents
    // newRegion.setParent(parent);
    return newRegion;
  }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion

  public ITextRegion createToken(String context, int start, int textLength, int length) {
    return this.createToken(context, start, textLength, length, null, null);
  }

  public ITextRegion createToken(String context, int start, int textLength, int length, String lang, String surroundingTag) {
    ITextRegion newRegion = null;
    if (context == DOMRegionContext.XML_CDATA_TEXT) {
      newRegion = new XMLCDataTextRegion(start, textLength, length);
    }
    else if (context == DOMRegionContext.XML_CONTENT) {
      newRegion = new XMLContentRegion(start, length);
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion

   */
  private DOMRegion formatRegion(TextEdit edit, Position formatRange, XMLFormattingConstraints parentConstraints, DOMRegion domRegion, IStructuredDocumentRegion previousRegion) {
    IStructuredDocumentRegion currentRegion = domRegion.documentRegion;
    String regionType = currentRegion.getType();
    if (DOMRegionContext.XML_TAG_NAME.equals(regionType)) {
      ITextRegion textRegion = currentRegion.getFirstRegion();
      String textRegionType = textRegion.getType();
      if (DOMRegionContext.XML_TAG_OPEN.equals(textRegionType)) {
        domRegion = formatStartTag(edit, formatRange, parentConstraints, domRegion, previousRegion);
      }
      else if (DOMRegionContext.XML_END_TAG_OPEN.equals(textRegionType)) {
        formatEndTag(edit, formatRange, parentConstraints, domRegion, previousRegion);
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion

        // format end tag
        boolean formatEndTag = false;
        if (nextRegion != null && currentDOMNode != null) {
          ITextRegionList rs = nextRegion.getRegions();
          if (rs.size() > 1) {
            ITextRegion r = rs.get(0);
            if (r != null && DOMRegionContext.XML_END_TAG_OPEN.equals(r.getType())) {
              r = rs.get(1);
              if (r != null && DOMRegionContext.XML_TAG_NAME.equals(r.getType())) {
                String tagName = nextRegion.getText(r);
                if (tagName != null && tagName.equals(currentDOMNode.getNodeName()))
                  formatEndTag = true;
              }
            }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion

    int availableLineWidth = constraints.getAvailableLineWidth();
    ITextRegionList textRegions = currentDocumentRegion.getRegions();
    int currentNumberOfRegions = currentDocumentRegion.getNumberOfRegions();
    int currentTextRegionIndex = 1;

    ITextRegion currentTextRegion = textRegions.get(currentTextRegionIndex);
    String currentType = currentTextRegion.getType();
    // tag name should always be the first text region
    if (DOMRegionContext.XML_TAG_NAME.equals(currentType) && currentTextRegionIndex < currentNumberOfRegions - 1) {
      ITextRegion nextTextRegion = textRegions.get(currentTextRegionIndex + 1);
      // Bug 221279 - Some non well-formed documents will not contribute a next region
      if (nextTextRegion != null && DOMRegionContext.XML_TAG_CLOSE.equals(nextTextRegion.getType())) {
        // calculate available line width
        int tagNameLineWidth = currentTextRegion.getTextLength() + 3;
        availableLineWidth -= tagNameLineWidth;

        if (XMLFormattingConstraints.INLINE.equals(indentStrategy)) {
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.