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

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


    return IMessage.NORMAL_SEVERITY;
  }

  private String getStartTagName(IStructuredDocumentRegion sdr) {
    String name = new String();
    ITextRegionList subRegions = sdr.getRegions();
    if (subRegions.size() > 2) {
      ITextRegion subRegion = subRegions.get(0);
      if (subRegion.getType() == DOMRegionContext.XML_TAG_OPEN) {
        subRegion = subRegions.get(1);
        if (subRegion.getType() == DOMRegionContext.XML_TAG_NAME) {
          name = sdr.getText(subRegion);
        }
      }
    }
View Full Code Here


  }

  private boolean hasJSPRegion(ITextRegion container) {
    if (!(container instanceof ITextRegionContainer))
      return false;
    ITextRegionList regions = ((ITextRegionContainer) container).getRegions();
    if (regions == null)
      return false;
    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;
    }

    // Find the attribute name for which this position should have a value
    IStructuredDocumentRegion open = node.getFirstStructuredDocumentRegion();
    ITextRegionList openRegions = open.getRegions();
    int i = openRegions.indexOf(contentAssistRequest.getRegion());
    if (i < 0)
      return;
    ITextRegion nameRegion = null;
    while (i >= 0) {
      nameRegion = openRegions.get(i--);
      if (nameRegion.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME)
        break;
    }
   
    // on an empty value, add all the JSP and taglib tags
View Full Code Here

    // ////////////////////////////////////////////////////////////////////////////
    // ANOTHER WORKAROUND UNTIL PARTITIONING TAKES CARE OF THIS
    // check for xml-jsp tags...
    if (partitionType == IJSPPartitions.JSP_DIRECTIVE && fn != null) {
      IStructuredDocumentRegion possibleXMLJSP = ((fn.getType() == DOMRegionContext.XML_CONTENT) && fn.getPrevious() != null) ? fn.getPrevious() : fn;
      ITextRegionList regions = possibleXMLJSP.getRegions();
      if (regions.size() > 1) {
        // check bounds cases
        ITextRegion xmlOpenOrClose = regions.get(0);
        if (xmlOpenOrClose.getType() == DOMRegionContext.XML_TAG_OPEN && documentPosition == possibleXMLJSP.getStartOffset()) {
          // do regular jsp content assist
        }
        else if (xmlOpenOrClose.getType() == DOMRegionContext.XML_END_TAG_OPEN && documentPosition > possibleXMLJSP.getStartOffset()) {
          // do regular jsp content assist
        }
        else {
          // possible xml-jsp
          ITextRegion nameRegion = regions.get(1);
          String name = possibleXMLJSP.getText(nameRegion);
          if (name.equals("jsp:scriptlet") || name.equals("jsp:expression") || name.equals("jsp:declaration")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            return getJSPJavaCompletionProposals(viewer, documentPosition);
          }
        }
View Full Code Here

      IndexedRegion indexedRegion = model.getIndexedRegion(offset);
      indexedRegions.add(indexedRegion);
      if (structuredDocumentRegion.getEndOffset() <= indexedRegion.getEndOffset())
        continue;

      ITextRegionList textRegions = structuredDocumentRegion.getRegions();
      int textRegionCount = textRegions.size();
      for (int textRegionIndex = 1; textRegionIndex < textRegionCount; ++textRegionIndex) {
        offset = structuredDocumentRegion.getStartOffset(textRegions.get(textRegionIndex));
        indexedRegion = model.getIndexedRegion(offset);
        indexedRegions.add(indexedRegion);
      }
    }
View Full Code Here

    if (fText == null || fText.isDisposed() || fInput == null || fInput.length() == 0)
      return;
    //    List regions = fParser.getRegions();
    IStructuredDocumentRegion node = fNodes;
    while (node != null) {
      ITextRegionList regions = node.getRegions();
      for (int i = 0; i < regions.size(); i++) {
        ITextRegion currentRegion = regions.get(i);
        // lookup the local coloring type and apply it
        String namedStyle = (String) getContextStyleMap().get(currentRegion.getType());
        if (namedStyle == null)
          continue;
        TextAttribute attribute = getAttribute(namedStyle);
View Full Code Here

  }

  private boolean isEmptyTag(ITextRegionCollection customTag, int index) {
    String type = null;
    // custom tag is embedded
    ITextRegionList regions = customTag.getRegions();
    ITextRegion nextRegion = regions.get(index);
    int size = customTag.getNumberOfRegions() ;
    type = nextRegion.getType();
    while (index <= size && !(DOMRegionContext.XML_EMPTY_TAG_CLOSE.equals(type) || DOMRegionContext.XML_TAG_NAME.equals(type) || DOMRegionContext.XML_TAG_CLOSE.equals(type) )) {
        nextRegion = regions.get(++index);
        type = nextRegion.getType();
    }
   
    return DOMRegionContext.XML_EMPTY_TAG_CLOSE.equals(type);
  }
View Full Code Here

 
  private boolean isEmptyTag(ITextRegionCollection customTag) {
    ITextRegion lastRegion = customTag.getLastRegion();
    // custom tag is embedded
    if (customTag instanceof ITextRegionContainer) {
      ITextRegionList regions = customTag.getRegions();
      int size = customTag.getNumberOfRegions() - 1;
      while (size > 0 && !(DOMRegionContext.XML_EMPTY_TAG_CLOSE.equals(lastRegion.getType()) || DOMRegionContext.XML_TAG_NAME.equals(lastRegion.getType()) || DOMRegionContext.XML_TAG_CLOSE.equals(lastRegion.getType()) )) {
        lastRegion = regions.get(--size);
      }
    }
   
    return DOMRegionContext.XML_EMPTY_TAG_CLOSE.equals(lastRegion.getType());
  }
View Full Code Here

   * but if other cases arise later then they could be added in here
   *
   * @param embeddedContainer the container that may contain EL
   */
  protected void translateXMLContent(ITextRegionContainer embeddedContainer) {
    ITextRegionList embeddedRegions = embeddedContainer.getRegions();
    int length = embeddedRegions.size();
    for (int i = 0; i < length; i++) {
      ITextRegion delim = embeddedRegions.get(i);
      String type = delim.getType();

      // check next region to see if it's EL content
      if (i + 1 < length) {
        if((type == DOMJSPRegionContexts.JSP_EL_OPEN || type == DOMJSPRegionContexts.JSP_VBL_OPEN)) {
          ITextRegion region = null;
         
          int start = delim.getEnd();
          while (++i < length) {
            region = embeddedRegions.get(i);
            if (region == null || !isELType(region.getType()))
              break;
          }
          fLastJSPType = EXPRESSION;
          String elText = embeddedContainer.getFullText().substring(start, (region != null ? region.getStart() : embeddedContainer.getLength() - 1));
View Full Code Here

   */
  private void translateEmbeddedJSPInAttribute(ITextRegionCollection embeddedContainer) {
    // THIS METHOD IS A FIX FOR
    // jsp embedded in attribute regions
    // loop all regions
    ITextRegionList embeddedRegions = embeddedContainer.getRegions();
    ITextRegion delim = null;
    ITextRegion content = null;
    String type = null;
    String quotetype = null;
    for (int i = 0; i < embeddedRegions.size(); i++) {

      // possible delimiter, check later
      delim = embeddedRegions.get(i);
      type = delim.getType();
      if (type == DOMRegionContext.XML_TAG_NAME ) {
        String fullTagName = embeddedContainer.getText(delim);
        if (fullTagName.indexOf(':') > -1 && !fullTagName.startsWith(JSP_PREFIX)) {
          ITextRegion prevRegion =null;
          if (i>0)
            prevRegion = embeddedRegions.get(i-1);
          addCustomTaglibVariables(fullTagName, embeddedContainer,prevRegion,i+1); // it may be a custom tag
        }
      }
      if(type == DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_DQUOTE || type == DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_SQUOTE
        || type == DOMJSPRegionContexts.JSP_TAG_ATTRIBUTE_VALUE_DQUOTE || type == DOMJSPRegionContexts.JSP_TAG_ATTRIBUTE_VALUE_SQUOTE)
        quotetype = type;

      // check next region to see if it's content
      if (i + 1 < embeddedRegions.size()) {
        String regionType = embeddedRegions.get(i + 1).getType();
        if (regionType == DOMJSPRegionContexts.JSP_CONTENT || regionType == DOMJSPRegionContexts.JSP_EL_CONTENT)
          content = embeddedRegions.get(i + 1);
      }

      if (content != null) {
        int contentStart = embeddedContainer.getStartOffset(content);
        int rStart = fCurrentNode.getStartOffset() + contentStart;
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.