Examples of IDOMNode


Examples of com.puppetlabs.xtext.dommodel.IDomNode

    // if this is the root
    if(getParent() == null) {
      // recalculate offsets starting with 0
      setOffset(0);
      // find and mark first and last token
      IDomNode first = DomModelUtils.firstTokenWithText(this);
      IDomNode last = DomModelUtils.lastTokenWithText(this);
      if(first != null && first instanceof AbstractDomNode)
        ((AbstractDomNode) first).setClassifiers(true, NodeClassifier.FIRST_TOKEN);
      if(last != null && last instanceof AbstractDomNode)
        ((AbstractDomNode) last).setClassifiers(true, NodeClassifier.LAST_TOKEN);
    }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode

    if (!(fInfo instanceof AttributeContextInformation)) {
      return false;
    }

    // iterate existing attributes from current node
    IDOMNode xmlNode = fModelUtil.getXMLNode(documentPosition);
    if (xmlNode == null)
      return false;
   
    IStructuredDocumentRegion sdRegion = xmlNode.getFirstStructuredDocumentRegion();
    ITextRegionList regions = sdRegion.getRegions();
    ITextRegion r = null;
    String attrName = ""; //$NON-NLS-1$
    Object temp = null;
    Position p = null;
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode

  }

  /**
   */
  public void setCommentTag(boolean isCommentTag) {
    IDOMNode parent = (IDOMNode) getParentNode();
    if (parent != null && !parent.isChildEditable()) {
      throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessages.NO_MODIFICATION_ALLOWED_ERR);
    }

    if (isCommentTag)
      fTagFlags |= FLAG_COMMENT;
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode

   *
   * @param isEmptyTag
   *            boolean
   */
  public void setEmptyTag(boolean isEmptyTag) {
    IDOMNode parent = (IDOMNode) getParentNode();
    if (parent != null && !parent.isChildEditable()) {
      throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, DOMMessages.NO_MODIFICATION_ALLOWED_ERR);
    }

    if (isEmptyTag)
      fTagFlags |= FLAG_EMPTY;
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode

   *
   * @param isJSPTag
   *            boolean
   */
  public void setJSPTag(boolean isJSPTag) {
    IDOMNode parent = (IDOMNode) getParentNode();
    if (parent != null && !parent.isChildEditable()) {
      throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, NodeImpl.EMPTY_STRING);
    }

    if (isJSPTag)
      fTagFlags |= FLAG_JSP;
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode

  }

  /**
   */
  public void setPrefix(String prefix) throws DOMException {
    IDOMNode parent = (IDOMNode) getParentNode();
    if (parent != null && !parent.isChildEditable()) {
      throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, NodeImpl.EMPTY_STRING);
    }

    int prefixLength = (prefix != null ? prefix.length() : 0);
    String localName = getLocalName();
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode

    IStructuredDocumentRegion sdRegion = fModelUtil.getDocument().getRegionAtCharacterOffset(offset);
    if (!canProposeInfo(sdRegion)) {
      return EMPTY_CONTEXT_INFO;
    }

    IDOMNode node = fModelUtil.getXMLNode(offset);
    if (node != null) {
      switch (node.getNodeType()) {
        case Node.ELEMENT_NODE :
          results = getInfoForElement(node);
          break;
        // future...
        // case Node.TEXT_NODE :
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode

    return mq;
  }

  public IDOMNode getXMLNode(int offset) {
    IStructuredModel xmlModel = null;
    IDOMNode xmlNode = null;
    try {
      xmlModel = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
      if (xmlModel != null) {
        xmlNode = (IDOMNode) xmlModel.getIndexedRegion(offset);
      }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode

      // get initial dom node
      IndexedRegion currentIndexedRegion = model.getIndexedRegion(startOffset);
      if (currentIndexedRegion instanceof IDOMNode) {
        // set up domRegion which will contain current region to be
        // formatted
        IDOMNode currentDOMNode = (IDOMNode) currentIndexedRegion;
        DOMRegion domRegion = new DOMRegion();
        domRegion.documentRegion = currentRegion;
        domRegion.domNode = currentDOMNode;
       
        XMLFormattingConstraints parentConstraints = getRegionConstraints(currentDOMNode);
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode

   * formatting constraints
   *
   * @return formatting constraints defined by an ancestor
   */
  private XMLFormattingConstraints getRegionConstraints(IDOMNode currentNode) {
    IDOMNode iterator = currentNode;
    XMLFormattingConstraints result = new XMLFormattingConstraints();
    DOMRegion region = new DOMRegion();
    XMLFormattingConstraints parentConstraints = new XMLFormattingConstraints();
    boolean parent = true;
   
    /* Iterate through the ancestry to find if any explicit whitespace strategy has
     * been defined
     */
    while(iterator != null && iterator.getNodeType() != Node.DOCUMENT_NODE) {
      iterator = (IDOMNode) iterator.getParentNode();
      region.domNode = iterator;
      region.documentRegion = iterator.getFirstStructuredDocumentRegion();
     
      updateFormattingConstraints(null, null, result, region);
     
      /* If this is the parent of the current node, keep the constraints
       * in case no other constraints are identified
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.