Package org.eclipse.wst.sse.core.internal.provisional.text

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


      ITextRegionList regions = taglibFlatNode.getRegions();
      String prefix = null;
      boolean taglib = false;
      try {
        for (int i = 0; i < regions.size(); i++) {
          ITextRegion region = regions.get(i);
          if (region.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) {
            int offset = taglibFlatNode.getStartOffset(region);
            int length = region.getTextLength();

            String name = getText(offset, length);
            if (name.startsWith(XMLNS) && name.length() > XMLNS.length()) { //$NON-NLS-1$
              prefix = name.substring(6);
              taglib = true;
            }
            else {
              prefix = null;
              taglib = false;
            }
          }
          else if (taglib && region.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) {
            prefix = StringUtils.strip(prefix);
            if (prefix != null && prefix.length() > 0) {
              enableForTaglib(prefix, taglibFlatNode);
              prefix = null;
            }
View Full Code Here


      ITextRegionList regions = taglibFlatNode.getRegions();
      String prefix = null;
      boolean prefixname = false;
      try {
        for (int i = 0; i < regions.size(); i++) {
          ITextRegion region = regions.get(i);
          if (region.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) {
            if (fCharSequenceSource != null && fCharSequenceSource instanceof IRegionComparible) {
              int offset = taglibFlatNode.getStartOffset(region);
              int length = region.getTextLength();
              prefixname = ((IRegionComparible) fCharSequenceSource).regionMatches(offset, length, JSP12TLDNames.PREFIX);
            }
            else {
              // old fashioned way
              prefixname = (getText(taglibFlatNode.getStartOffset(region), region.getTextLength()).equals(JSP12TLDNames.PREFIX));
            }
          }
          else if (prefixname && region.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) {
            prefix = getText(taglibFlatNode.getStartOffset(region), region.getTextLength());
          }
        }
      }
      catch (StringIndexOutOfBoundsException sioobExc) {
        // nothing to be done
View Full Code Here

      else if (nodeType == Node.ATTRIBUTE_NODE) {
        // handle attribute nodes
        IDOMAttr att = (IDOMAttr) node;
        // do not include quotes in attribute value region
        int regOffset = att.getValueRegionStartOffset();
        ITextRegion valueRegion = att.getValueRegion();
        if (valueRegion != null) {
          int regLength = valueRegion.getTextLength();
          String attValue = att.getValueRegionText();
          if (StringUtils.isQuoted(attValue)) {
            ++regOffset;
            regLength = regLength - 2;
          }
View Full Code Here

    return (hyperLinkStart <= detectionStart && detectionStart < hyperLinkEnd) || (hyperLinkStart <= detectionEnd && detectionEnd <= hyperLinkEnd);// ||
  }

  private IRegion getNameRegion(ITextRegionCollection containerRegion) {
    ITextRegionList regions = containerRegion.getRegions();
    ITextRegion nameRegion = null;
    for (int i = 0; i < regions.size(); i++) {
      ITextRegion r = regions.get(i);
      if (r.getType() == DOMRegionContext.XML_TAG_NAME) {
        nameRegion = r;
        break;
      }
    }
    if (nameRegion != null)
View Full Code Here

         * used here will be parsed differently, respecting the
         * comment since it's not in a tag block region any more, and
         * the custom tags in the comment will not be found. Run those
         * comment text pieces through the translator on their own.
         */
        ITextRegion first = sdRegion.getFirstRegion();
        ITextRegion last = sdRegion.getLastRegion();

        /* Decode everything between the comment delimiters at once */
        if (DOMRegionContext.XML_COMMENT_OPEN.equals(first.getType()) && DOMRegionContext.XML_COMMENT_CLOSE.equals(last.getType())) {
          fTranslator.decodeScriptBlock(sdRegion.getFullText().substring(first.getEnd(), last.getStart()), 0);
        }
      }
      // this updates cursor position
      checkCursorInRegion(sdRegion);
    }
View Full Code Here

  }

  private void decodeRemainingRegions(IStructuredDocumentRegion sdRegion, int start) {
    ITextRegionList regionList = sdRegion.getRegions();
    if(regionList != null) {
      ITextRegion region = regionList.get(start);
      String text = sdRegion.getFullText();
      if (text != null && region != null && region.getStart() <= text.length())
        fTranslator.decodeScriptBlock(text.substring(region.getStart(), text.length()), 0);
    }
  }
View Full Code Here

        int matchStart = -1;
        int matchEnd = -1;
        String findRegionText = ""; //$NON-NLS-1$

        ITextRegion r = null;
        ITextRegionList regions = null;
        IStructuredDocumentRegion current = this.fFindRegionsDocument.getFirstStructuredDocumentRegion();

        // this is the main loop that iterates the document
        while (current != null && !isCanceled(monitor)) {
          regions = current.getRegions();
          for (int i = 0; i < regions.size() && !isCanceled(monitor); i++) {

            r = regions.get(i);

            // maybe this is the equals check where some valid
            // matches are failing (like searching on end tag)
            if (r.getType().equals(this.fMatchRegionType) && current.getText(r).equals(this.fMatchName)) {

              findRegionText = current.getText(r);

              // region found
              matchStart = current.getStartOffset(r);
View Full Code Here

  }

  private int hasIllegalContent(IStructuredDocumentRegion sdRegion) {
    ITextRegionList list = sdRegion.getRegions();
    for (int i = 0; i < list.size(); i++) {
      ITextRegion region = list.get(i);
      String type = region.getType();
      if (type == DOMRegionContext.UNDEFINED)
        return i;
      if (type == DOMRegionContext.XML_END_TAG_OPEN || type == DOMRegionContext.XML_EMPTY_TAG_CLOSE || type == DOMJSPRegionContexts.JSP_DIRECTIVE_CLOSE)
        return -1;
    }
View Full Code Here

   */
  protected String getAttributeValue(String attrName, IStructuredDocumentRegion sdRegion) {
    String sdRegionText = fTextToParse.substring(sdRegion.getStartOffset(), sdRegion.getEndOffset());
    String textRegionText, attrValue = ""; //$NON-NLS-1$
    Iterator it = sdRegion.getRegions().iterator();
    ITextRegion nameRegion, valueRegion = null;
    while (it.hasNext()) {
      nameRegion = (ITextRegion) it.next();
      if (nameRegion.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) {
        textRegionText = sdRegionText.substring(nameRegion.getStart(), nameRegion.getTextEnd());
        if (textRegionText.equalsIgnoreCase(attrName)) {
          while (it.hasNext()) {
            valueRegion = (ITextRegion) it.next();
            if (valueRegion.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) {
              attrValue = sdRegionText.substring(valueRegion.getStart(), valueRegion.getEnd());
View Full Code Here

  protected String getRegionName(IStructuredDocumentRegion sdRegion) {

    String nameStr = ""; //$NON-NLS-1$
    ITextRegionList regions = sdRegion.getRegions();
    for (int i = 0; i < regions.size(); i++) {
      ITextRegion r = regions.get(i);
      if (r.getType() == DOMRegionContext.XML_TAG_NAME) {
        nameStr = fTextToParse.substring(sdRegion.getStartOffset(r), sdRegion.getTextEndOffset(r));
        break;
      }
    }
    return nameStr.trim();
View Full Code Here

TOP

Related Classes of org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion

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.