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

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


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


    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

      return false;
    /*
     * shouldn't get a tag name region type unless a tag name region
     * exists at [1]
     */
    ITextRegion tagNameRegion = sdRegion.getRegions().get(1);
    String tagName = sdRegion.getText(tagNameRegion);

    RegionParser parser = fStructuredDocument.getParser();
    if (parser instanceof JSPSourceParser) {
      if (tagName.equals(fLastCheckedPrefix))
View Full Code Here

  /* (non-Javadoc)
   * @see org.eclipse.wst.sse.core.internal.text.rules.StructuredTextPartitioner#doParserSpecificCheck(int, boolean, org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion, org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion, org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion, org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion)
   */
  protected boolean doParserSpecificCheck(int offset, boolean partitionFound, IStructuredDocumentRegion sdRegion, IStructuredDocumentRegion previousStructuredDocumentRegion, ITextRegion next, ITextRegion previousStart) {
    if (previousStart != null && previousStart.getType() == DOMRegionContext.XML_TAG_OPEN && next.getType() == DOMRegionContext.XML_END_TAG_OPEN) {
      ITextRegion previousName = previousStructuredDocumentRegion.getRegionAtCharacterOffset(previousStructuredDocumentRegion.getEndOffset(previousStart));
      ITextRegion nextName = sdRegion.getRegionAtCharacterOffset(sdRegion.getEndOffset(next));
      if (previousName != null && nextName != null && previousName.getType() == DOMRegionContext.XML_TAG_NAME && nextName.getType() == DOMRegionContext.XML_TAG_NAME) {
        setInternalPartition(offset, 0, getPartitionTypeBetween(previousStructuredDocumentRegion, sdRegion));
        partitionFound = true;
      }
    }
    return partitionFound;
View Full Code Here

  }

  /**
   */
  private Segment getErrorSegment(IDOMNode errorNode, int regionType) {
    ITextRegion rgn = null;
    switch (regionType) {
      case REGION_NAME :
        rgn = errorNode.getNameRegion();
        break;
      case REGION_VALUE :
        rgn = errorNode.getValueRegion();
        break;
      default :
        // nothing to do.
        break;
    }
    if (rgn != null) {
      if (errorNode instanceof IDOMAttr) {
        IDOMElement ownerElement = (IDOMElement) ((IDOMAttr) errorNode).getOwnerElement();
        if (ownerElement != null) {
          //if editor closed during validation this could be null
          IStructuredDocumentRegion firstRegion = ownerElement.getFirstStructuredDocumentRegion();
          if(firstRegion != null) {
            int regionStartOffset = firstRegion.getStartOffset(rgn);
            int regionLength = rgn.getTextLength();
            return new Segment(regionStartOffset, regionLength);
          }
        }
      }
    }
View Full Code Here

        // Then, the value must be checked.
        if (state == ErrorState.NONE_ERROR) { // Need more check.
          // Now, the value should be checked, if the type is ENUM.
          CMDataType attrType = adec.getAttrType();
          if (a instanceof IDOMAttr) {
            final ITextRegion region = ((IDOMAttr) a).getEqualRegion();
            if (region == null) {
              rgnType = REGION_NAME;
              state = ErrorState.MISSING_ATTR_VALUE_EQUALS_ERROR;
            }
          }
View Full Code Here

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

      String prefix = a.getPrefix();
      if ((prefix != null) && isUnknownAttr(a, target)) {
        // The attr has unknown prefix.  So, check it.
        if (!isValidPrefix(prefix, target)) {
          // report unknown attr error.
          ITextRegion r = a.getNameRegion();
          if (r == null)
            continue;
          int a_offset = a.getNameRegionStartOffset();
          int a_length = a.getNameRegion().getLength();
          reporter.report(new ErrorInfoImpl(UNDEFINED_NAME_ERROR, new Segment(a_offset, a_length), a));
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

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.