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

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


    if (flatNode instanceof StructuredDocumentRegionProxy) {
      return flatNode.getText();
    }

    ITextRegion region = StructuredDocumentRegionUtil.getFirstRegion(flatNode);
    if (region != null) {
      String regionType = region.getType();
      if (regionType == DOMRegionContext.XML_ENTITY_REFERENCE || regionType == DOMRegionContext.XML_CHAR_REFERENCE) {
        String name = StructuredDocumentRegionUtil.getEntityRefName(flatNode, region);
        if (name != null) {
          DocumentImpl document = (DocumentImpl) getOwnerDocument();
          if (document != null) {
View Full Code Here


    if (flatNode == null)
      return DOMRegionContext.UNDEFINED;
    ITextRegionList regions = flatNode.getRegions();
    if (regions == null || regions.size() == 0)
      return DOMRegionContext.UNDEFINED;
    ITextRegion region = regions.get(0);
    return region.getType();
  }
View Full Code Here

    if (flatNode == null)
      return DOMRegionContext.UNDEFINED;
    ITextRegionList regions = flatNode.getRegions();
    if (regions == null || regions.size() == 0)
      return DOMRegionContext.UNDEFINED;
    ITextRegion region = regions.get(regions.size() - 1);
    return region.getType();
  }
View Full Code Here

          ITextRegionList list = curNode.getRegions();
          String text = curNode.getText();
          String tagName  = null;
          String attrName = null;
          for(int j=0;j<list.size();j++){
            ITextRegion region = list.get(j);
            if(region.getType()==DOMRegionContext.XML_TAG_NAME){
              tagName = text.substring(region.getStart(), region.getEnd()).trim();
             
            } else if(region.getType()==DOMRegionContext.XML_TAG_ATTRIBUTE_NAME){
              attrName = text.substring(region.getStart(), region.getEnd()).trim();
             
            } else if(region.getType()==DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE){
              String attrValue = text.substring(region.getStart(), region.getEnd()).trim();
              int length = attrValue.length();
              attrValue = attrValue.replaceAll("^\"|\"$","");
              if(tagName!=null && attrName!=null){
                validateAttributeValue(file, tagName, attrName, attrValue,
                    curNode.getStart() + region.getStart(), length);
              }
              attrName = null;
            }
          }
        }
View Full Code Here

  static private String getTagName(IStructuredDocumentRegion tag) {
    ITextRegionList regions = tag.getRegions();
    Iterator iter = regions.iterator();
    while (iter.hasNext()) {
      ITextRegion rgn = (ITextRegion) iter.next();
      if (rgn.getType() == DOMRegionContext.XML_TAG_NAME)
        return tag.getText(rgn);
    }
    return "";//$NON-NLS-1$
  }
View Full Code Here

    ITextRegionList regions = info.endTag.getRegions();
    if (regions == null || regions.isEmpty())
      return false;
    Iterator iter = regions.iterator();
    while (iter.hasNext()) {
      ITextRegion rgn = (ITextRegion) iter.next();
      if (!isValidRegion(rgn))
        return true; // found invalid region type.
    }
    return false; // all regions are valid.
  }
View Full Code Here

  private String getEndTagFullText(ElementInfo info) {
    String hint = "";//$NON-NLS-1$
    ITextRegionList regions = info.endTag.getRegions();
    Iterator iter = regions.iterator();
    while (iter.hasNext()) {
      ITextRegion rgn = (ITextRegion) iter.next();
      String type = rgn.getType();
      if (type == null)
        continue;
      if (type == DOMRegionContext.XML_END_TAG_OPEN || type == DOMRegionContext.XML_TAG_CLOSE)
        continue;
      hint += info.endTag.getFullText(rgn);
View Full Code Here

  private String getScriptingPartitionType(IStructuredDocumentRegion coreNode) {
    String language = null;
    String type = null;
    String result = IHTMLPartitions.SCRIPT;
    IStructuredDocumentRegion node = coreNode;
    ITextRegion attrNameRegion = null;
    while (node != null && isValidScriptingRegionType(node.getType())) {
      node = node.getPrevious();
    }

    ITextRegionList regions = node.getRegions();
    if (regions.size() > 4 && regions.get(1).getType() == DOMRegionContext.XML_TAG_NAME) {
      ITextRegion potentialLanguageRegion = regions.get(1);
      String potentialLanguageString = node.getText(potentialLanguageRegion);
      if (potentialLanguageString.equalsIgnoreCase(HTML40Namespace.ElementName.SCRIPT)) {
        for (int i = 0; i < regions.size(); i++) {
          ITextRegion region = regions.get(i);
          String regionType = region.getType();
          if (regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME)
            attrNameRegion = region;
          else if (regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) {
            String attrName = node.getText(attrNameRegion);
            if (attrName.equalsIgnoreCase(HTML40Namespace.ATTR_NAME_LANGUAGE))
View Full Code Here

    return result;
  }

  public String getPartitionTypeBetween(IStructuredDocumentRegion previousNode, IStructuredDocumentRegion nextNode) {
   
    ITextRegion previousStartTagNameRegion = null;
    ITextRegion nextEndTagNameRegion = null;
   
    ITextRegion[] regions = previousNode.getRegions().toArray();
    for (int i = 0; i < regions.length; i++) {
      if(regions[i].getType() == DOMRegionContext.XML_TAG_NAME) {
        previousStartTagNameRegion = regions[i];
View Full Code Here

     * 4 is the minimum index allowing for the tag's open, name, attribute
     * name and equals character to appear first
     */
    if (currentIndex < 4)
      return false;
    ITextRegion tagAttrNameRegion = regionList.get(currentIndex - 2);
   
    boolean foundAttributeName = false;
    if (fStructuredDocument instanceof IRegionComparible) {
      int start = node.getStartOffset(tagAttrNameRegion);
      for (int i = 0; !foundAttributeName && i < attributeNames.length; i++) {
        foundAttributeName = ((IRegionComparible) fStructuredDocument).regionMatchesIgnoreCase(start, tagAttrNameRegion.getTextLength(), attributeNames[i]);
      }
    }
    else {
      String tagAttrName = node.getText(tagAttrNameRegion);
      foundAttributeName = StringUtils.contains(attributeNames, tagAttrName, false);
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.