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

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


  public int getNameRegionStartOffset() {
    if (this.ownerElement == null)
      return 0;
    // assuming the firstStructuredDocumentRegion is the one that contains
    // attributes
    IStructuredDocumentRegion flatNode = this.ownerElement.getFirstStructuredDocumentRegion();
    if (flatNode == null)
      return 0;
    return flatNode.getStartOffset(this.nameRegion);
  }
View Full Code Here


  public String getNameRegionText() {
    if (this.ownerElement == null)
      return null;
    // assuming the firstStructuredDocumentRegion is the one that contains
    // attributes
    IStructuredDocumentRegion flatNode = this.ownerElement.getFirstStructuredDocumentRegion();
    if (flatNode == null)
      return null;
    return flatNode.getText(this.nameRegion);
  }
View Full Code Here

  public int getNameRegionTextEndOffset() {
    if (this.ownerElement == null)
      return 0;
    // assuming the firstStructuredDocumentRegion is the one that contains
    // attributes
    IStructuredDocumentRegion flatNode = this.ownerElement.getFirstStructuredDocumentRegion();
    if (flatNode == null)
      return 0;
    return flatNode.getTextEndOffset(this.nameRegion);
  }
View Full Code Here

  public int getValueRegionStartOffset() {
    if (this.ownerElement == null)
      return 0;
    // assuming the firstStructuredDocumentRegion is the one that contains
    // the valueRegion -- should make smarter?
    IStructuredDocumentRegion structuredDocumentRegion = this.ownerElement.getFirstStructuredDocumentRegion();
    if (structuredDocumentRegion == null)
      return 0;
    // ensure we never pass null to getStartOffset.
    if (this.fValueRegion == null) {
      return 0;
    }
    return structuredDocumentRegion.getStartOffset(this.fValueRegion);
  }
View Full Code Here

  public String getValueRegionText() {
    if (this.ownerElement == null)
      return null;
    // assuming the firstStructuredDocumentRegion is the one that contains
    // attributes
    IStructuredDocumentRegion flatNode = this.ownerElement.getFirstStructuredDocumentRegion();
    if (flatNode == null)
      return null;
    if (this.fValueRegion == null)
      return null;
    return flatNode.getText(this.fValueRegion);
  }
View Full Code Here

    // case,
    // when trying go format an XML file.
    if (this.ownerElement == null)
      return null;
    //attribute values will always be in the start region
    IStructuredDocumentRegion ownerRegion = this.ownerElement.getStartStructuredDocumentRegion();
    if (ownerRegion == null)
      return null;
    if (this.fValueRegion != null)
      return StructuredDocumentRegionUtil.getAttrValue(ownerRegion, this.fValueRegion);
    return NodeImpl.EMPTY_STRING;
View Full Code Here

   */
  IStructuredDocumentRegion appendStructuredDocumentRegion(IStructuredDocumentRegion newStructuredDocumentRegion) {
    if (newStructuredDocumentRegion == null)
      return null;

    IStructuredDocumentRegion flatNode = getStructuredDocumentRegion();
    if (flatNode == null) {
      setStructuredDocumentRegion(newStructuredDocumentRegion);
      return newStructuredDocumentRegion;
    }

View Full Code Here

      if (length < 16)
        length = 16; // default
      StringBuffer buffer = new StringBuffer(length);
      int count = container.getStructuredDocumentRegionCount();
      for (int i = 0; i < count; i++) {
        IStructuredDocumentRegion content = container.getStructuredDocumentRegion(i);
        String data = getData(content);
        if (data == null)
          continue;
        buffer.append(data);
      }
View Full Code Here

   */
  boolean hasStructuredDocumentRegion(IStructuredDocumentRegion askedStructuredDocumentRegion) {
    if (askedStructuredDocumentRegion == null)
      return false;

    IStructuredDocumentRegion flatNode = getStructuredDocumentRegion();
    if (flatNode == null)
      return false;

    if (flatNode == askedStructuredDocumentRegion)
      return true;

    if (flatNode instanceof StructuredDocumentRegionProxy) {
      StructuredDocumentRegionProxy proxy = (StructuredDocumentRegionProxy) flatNode;
      if (proxy.getStructuredDocumentRegion() == askedStructuredDocumentRegion)
        return true;
      return false;
    }

    if (flatNode instanceof StructuredDocumentRegionContainer) {
      StructuredDocumentRegionContainer container = (StructuredDocumentRegionContainer) flatNode;
      int count = container.getStructuredDocumentRegionCount();
      for (int i = 0; i < count; i++) {
        IStructuredDocumentRegion content = container.getStructuredDocumentRegion(i);
        if (content == null)
          continue;
        if (content == askedStructuredDocumentRegion)
          return true;
        if (content instanceof StructuredDocumentRegionProxy) {
View Full Code Here

    if (newStructuredDocumentRegion == null)
      return null;
    if (nextStructuredDocumentRegion == null)
      return appendStructuredDocumentRegion(newStructuredDocumentRegion);

    IStructuredDocumentRegion flatNode = getStructuredDocumentRegion();
    if (flatNode == null)
      return null; // error

    if (flatNode == nextStructuredDocumentRegion) {
      StructuredDocumentRegionContainer container = new StructuredDocumentRegionContainer();
      container.appendStructuredDocumentRegion(newStructuredDocumentRegion);
      container.appendStructuredDocumentRegion(flatNode);
      setStructuredDocumentRegion(container);
      return newStructuredDocumentRegion;
    }

    if (flatNode instanceof StructuredDocumentRegionContainer) {
      StructuredDocumentRegionContainer container = (StructuredDocumentRegionContainer) flatNode;
      int count = container.getStructuredDocumentRegionCount();
      for (int i = 0; i < count; i++) {
        IStructuredDocumentRegion content = container.getStructuredDocumentRegion(i);
        if (content == nextStructuredDocumentRegion) {
          container.insertStructuredDocumentRegion(newStructuredDocumentRegion, i);
          return newStructuredDocumentRegion;
        }
      }
View Full Code Here

TOP

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

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.