Examples of ITextRegionList


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

   * @return <code>true</code> if the attribute name associated with the given offset is in the given
   * list of attribute names, <code>false</code> otherwise
   */
  private boolean isAttributeNameForValueInArray(String[] attributeNames, ITextRegion attrValueRegion, int offset) {
    IStructuredDocumentRegion node = fStructuredDocument.getRegionAtCharacterOffset(offset);
    ITextRegionList regionList = node.getRegions();
    int currentIndex = regionList.indexOf(attrValueRegion);
   
    /*
     * 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++) {
View Full Code Here

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

   * complicated (like JSP regions) to validate with this validator.
   */
  private boolean hasNestedRegion(ITextRegion container) {
    if (!(container instanceof ITextRegionContainer))
      return false;
    ITextRegionList regions = ((ITextRegionContainer) container).getRegions();
    if (regions == null)
      return false;
    // BUG207194: return true by default as long as container is an
    // ITextRegionContainer with at least 1 region
    return true;
View Full Code Here

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

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

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

   * @return <code>true</code> if the attribute name associated with the given offset is in the given
   * list of attribute names, <code>false</code> otherwise
   */
  private boolean isAttributeNameForValueInArray(String[] attributeNames, ITextRegion attrValueRegion, int offset) {
    IStructuredDocumentRegion node = fStructuredDocument.getRegionAtCharacterOffset(offset);
    ITextRegionList regionList = node.getRegions();
    int currentIndex = regionList.indexOf(attrValueRegion);
   
    /*
     * 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++) {
View Full Code Here

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

    }
    return seg;
  }

  private static ITextRegion 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;
      }
    }
View Full Code Here

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

    String result = "UNKNOWN"; //$NON-NLS-1$
    while (sdRegion != null && isValidJspActionRegionType(sdRegion.getType()))
      sdRegion = sdRegion.getPrevious();

    if (sdRegion != null) {
      ITextRegionList regions = sdRegion.getRegions();
      // only find parent names from a start tag
      if (regions.size() > 1) {
        ITextRegion r = regions.get(1);
        if (regions.get(0).getType().equals(DOMRegionContext.XML_TAG_OPEN) && r.getType().equals(DOMRegionContext.XML_TAG_NAME)) {
          result = sdRegion.getText(r);
        }
      }
    }
    return result;
View Full Code Here

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

   * complicated (like JSP regions) to validate with this validator.
   */
  private boolean hasNestedRegion(ITextRegion container) {
    if (!(container instanceof ITextRegionContainer))
      return false;
    ITextRegionList regions = ((ITextRegionContainer) container).getRegions();
    if (regions == null)
      return false;
    // BUG207194: return true by default as long as container is an
    // ITextRegionContainer with at least 1 region
    return true;
View Full Code Here

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

  /**
   */
  private String getData(IStructuredDocumentRegion flatNode) {
    if (flatNode == null)
      return null;
    ITextRegionList regions = flatNode.getRegions();
    if (regions == null)
      return null;

    String data = null;
    Iterator e = regions.iterator();
    while (e.hasNext()) {
      ITextRegion region = (ITextRegion) e.next();
      String regionType = region.getType();
      if (isCommentText(regionType)) {
        data = flatNode.getText(region);
View Full Code Here

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

    }
    return false;
  }

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

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

      return Node.ELEMENT_NODE;
    }
  }

  private boolean isEndTagCorrupted(ElementInfo info) {
    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.
    }
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.