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

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


        }
      }
    }

    protected void processXMLStartTag(ITextRegionCollection startTagRegionCollection, IStructuredDocumentRegion anchorStructuredDocumentRegion, XMLSourceParser textSource) {
      ITextRegionList regions = startTagRegionCollection.getRegions();
      String uri = null;
      String prefix = null;
      boolean isTaglibValue = false;
      // skip the first two, they're the open bracket and name
      for (int i = 2; i < regions.size(); i++) {
        ITextRegion region = regions.get(i);
        if (region instanceof ITextRegionCollection) {
          // Handle nested directives
          processRegionCollection((ITextRegionCollection) region, anchorStructuredDocumentRegion, textSource);
        }
        else {
View Full Code Here


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

    /**
     * Pulls the URI and prefix from the given taglib directive
     * IStructuredDocumentRegion and makes sure the tags are known.
     */
    protected void processTaglib(ITextRegionCollection taglibDirectiveCollection, IStructuredDocumentRegion anchorStructuredDocumentRegion, XMLSourceParser textSource) {
      ITextRegionList regions = taglibDirectiveCollection.getRegions();
      String uri = null;
      String prefix = null;
      String tagdir = null;
      String attrName = null;
      try {
        for (int i = 2; i < regions.size(); i++) {
          ITextRegion region = regions.get(i);
          // remember attribute name
          int startOffset = taglibDirectiveCollection.getStartOffset(region);
          int textLength = region.getTextLength();
          if (region.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME) {
            // String name = textSource.getText(startOffset,
View Full Code Here

    IDOMModel structuredModel = node.getModel();
    IStructuredDocument structuredDocument = structuredModel.getStructuredDocument();

    IStructuredDocumentRegion startTagStructuredDocumentRegion = node.getStartStructuredDocumentRegion();
    if (startTagStructuredDocumentRegion != null) {
      ITextRegionList regions = startTagStructuredDocumentRegion.getRegions();
      if (regions != null && regions.size() > 0) {
        ITextRegion startTagNameRegion = regions.get(1);
        int startTagNameStartOffset = startTagStructuredDocumentRegion.getStartOffset(startTagNameRegion);
        int startTagNameLength = startTagStructuredDocumentRegion.getTextEndOffset(startTagNameRegion) - startTagNameStartOffset;

        if (!newTagName.equals(oldTagName))
          replaceSource(structuredModel, structuredDocument, startTagNameStartOffset, startTagNameLength, newTagName);
        newNode = (IDOMNode) structuredModel.getIndexedRegion(startTagNameStartOffset); // save
        // new
        // node
      }
    }

    IStructuredDocumentRegion endTagStructuredDocumentRegion = node.getEndStructuredDocumentRegion();
    if (endTagStructuredDocumentRegion != null) {
      ITextRegionList regions = endTagStructuredDocumentRegion.getRegions();
      if (regions != null && regions.size() > 0) {
        ITextRegion endTagNameRegion = regions.get(1);
        int endTagNameStartOffset = endTagStructuredDocumentRegion.getStartOffset(endTagNameRegion);
        int endTagNameLength = endTagStructuredDocumentRegion.getTextEndOffset(endTagNameRegion) - endTagNameStartOffset;

        if (startTagStructuredDocumentRegion != endTagStructuredDocumentRegion && !newTagName.equals(oldTagName))
          replaceSource(structuredModel, structuredDocument, endTagNameStartOffset, endTagNameLength, newTagName);
View Full Code Here

      // do nothing
    }
    else if (isEmptyElement(element)) {
      IStructuredDocument structuredDocument = structuredModel.getStructuredDocument();
      IStructuredDocumentRegion startStructuredDocumentRegion = node.getStartStructuredDocumentRegion();
      ITextRegionList regions = startStructuredDocumentRegion.getRegions();
      ITextRegion lastRegion = regions.get(regions.size() - 1);
      replaceSource(structuredModel, structuredDocument, startStructuredDocumentRegion.getStartOffset(lastRegion), lastRegion.getLength(), EMPTY_TAG_CLOSE);

      if (regions.size() > 1) {
        ITextRegion regionBeforeTagClose = regions.get(regions.size() - 1 - 1);

        // insert a space separator before tag close if the previous
        // region does not have extra spaces
        if (regionBeforeTagClose.getTextLength() == regionBeforeTagClose.getLength())
          replaceSource(structuredModel, structuredDocument, startStructuredDocumentRegion.getStartOffset(lastRegion), 0, " "); //$NON-NLS-1$
View Full Code Here

        startTagStructuredDocumentRegion = newNode.getStartStructuredDocumentRegion();
      }

      IStructuredDocumentRegion endTagStructuredDocumentRegion = newNode.getEndStructuredDocumentRegion();

      ITextRegionList regionList = startTagStructuredDocumentRegion.getRegions();
      if (startTagStructuredDocumentRegion != null && regionList != null && regionList.get(regionList.size() - 1).getType() == DOMRegionContext.XML_EMPTY_TAG_CLOSE) {

      }
      else {
        if (startTagStructuredDocumentRegion == null) {
          // start tag missing
View Full Code Here

      }
      return;
    }

    ITextRegion prevRegion = null;
    ITextRegionList regions = endStructuredDocumentRegion.getRegions();
    Iterator e = regions.iterator();
    while (e.hasNext()) {
      ITextRegion region = (ITextRegion) e.next();
      if (region == null)
        continue;
      String regionType = region.getType();
View Full Code Here

    return newNode;
  }

  protected void insertTagClose(IDOMModel structuredModel, IStructuredDocumentRegion flatNode) {
    if ((flatNode != null) && (flatNode.getRegions() != null)) {
      ITextRegionList regionList = flatNode.getRegions();
      ITextRegion lastRegion = regionList.get(regionList.size() - 1);
      if (lastRegion != null) {
        String regionType = lastRegion.getType();
        if ((regionType != DOMRegionContext.XML_EMPTY_TAG_CLOSE) && (regionType != DOMRegionContext.XML_TAG_CLOSE)) {
          IStructuredDocument structuredDocument = structuredModel.getStructuredDocument();
View Full Code Here

      breakSpaces += indent;
    }
    ITextRegion lastBreakRegion = null;

    ITextRegion prevRegion = null;
    ITextRegionList regions = startStructuredDocumentRegion.getRegions();
    Iterator e = regions.iterator();
    while (e.hasNext()) {
      ITextRegion region = (ITextRegion) e.next();
      if (region == null)
        continue;
View Full Code Here

    if ((compressEmptyElementTags && startTagStructuredDocumentRegion != endTagStructuredDocumentRegion &&
        startTagStructuredDocumentRegion != null)) {

      //only compress end tags if its XHTML or not a container
      if(isXMLTag((IDOMElement)newNode) || !newNode.isContainer()) {
        ITextRegionList regions = startTagStructuredDocumentRegion.getRegions();
        ITextRegion lastRegion = regions.get(regions.size() - 1);
        // format children and end tag if not empty element tag
        if (lastRegion.getType() != DOMRegionContext.XML_EMPTY_TAG_CLOSE) {
          NodeList childNodes = newNode.getChildNodes();
          if (childNodes == null || childNodes.getLength() == 0 || (childNodes.getLength() == 1 && (childNodes.item(0)).getNodeType() == Node.TEXT_NODE && ((childNodes.item(0)).getNodeValue().trim().length() == 0))) {
            IDOMModel structuredModel = newNode.getModel();
View Full Code Here

TOP

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

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.