Package org.eclipse.jst.pagedesigner.dom

Examples of org.eclipse.jst.pagedesigner.dom.DOMRange


        for (int i = 0, size = nodes.getLength(); i < size; i++) {
          common.getParentNode().insertBefore(nodes.item(i), common);
        }
        common.getParentNode().removeChild(common);
        return new DOMRange(start, end);
      }
      start = DOMPositionHelper.toDOMRefPosition(start);
      end = DOMPositionHelper.toDOMRefPosition(end);
      Node newHNode = EditModelQuery.getDocumentNode(common)
          .createElement(getTag());
      EditModelQuery.copyChildren(common, newHNode);
      common.getParentNode().replaceChild(newHNode, common);
      return new DOMRange(start, end);
    }
    return null;
  }
View Full Code Here


                    .getAttribute(IHTMLConstants.ATTR_ALIGN))) {
          ((Element) parentNode)
              .removeAttribute(IHTMLConstants.ATTR_ALIGN);
          IDOMPosition startPos = new DOMPosition(parentNode, 0);
          IDOMPosition endPos = new DOMRefPosition(endNode, true);
          return new DOMRange(startPos, endPos);
        }
        // else replace the align attribute
        /**
         * this._applyingNode.appendChild(startNode);
         * parentNode.getParentNode().replaceChild(this._applyingNode,
         * parentNode);
         */
        String align = this.getApplyingNode()
            .getAttribute(IHTMLConstants.ATTR_ALIGN);
        ((Element) parentNode).setAttribute(IHTMLConstants.ATTR_ALIGN,
            align);

        IDOMPosition startPos = new DOMPosition(parentNode, 0);
        IDOMPosition endPos = new DOMRefPosition(endNode, true);
        return new DOMRange(startPos, endPos);
      }
    } else {
      if (parentNode != null
          && parentNode.getNodeName().equalsIgnoreCase(
              IHTMLConstants.TAG_P)
          && parentNode.getChildNodes().getLength() == len) {
        if (this.getApplyingNode()
            .getAttribute(IHTMLConstants.ATTR_ALIGN)
            .equals(
                ((Element) parentNode)
                    .getAttribute(IHTMLConstants.ATTR_ALIGN))) {
          ((Element) parentNode)
              .removeAttribute(IHTMLConstants.ATTR_ALIGN);
          IDOMPosition startPos = new DOMPosition(parentNode, 0);
          IDOMPosition endPos = new DOMRefPosition(endNode, true);
          return new DOMRange(startPos, endPos);
        }

        /**
         * Node sibling = startNode.getNextSibling();
         * this._applyingNode.appendChild(startNode); Node
         * endNodeSibling = endNode.getNextSibling(); while (sibling !=
         * null && startNode != endNode && sibling != endNodeSibling) {
         * Node tempNode = sibling.getNextSibling();
         * this._applyingNode.appendChild(sibling); sibling = tempNode; }
         * parentNode.getParentNode().replaceChild(this._applyingNode,
         * parentNode);
         */
        String align = this.getApplyingNode()
            .getAttribute(IHTMLConstants.ATTR_ALIGN);
        ((Element) parentNode).setAttribute(IHTMLConstants.ATTR_ALIGN,
            align);

        IDOMPosition startPos = new DOMPosition(parentNode, 0);
        IDOMPosition endPos = new DOMRefPosition(endNode, true);
        return new DOMRange(startPos, endPos);
      }
    }
    return null;
  }
View Full Code Here

          sibling = tempNode;
        }

        IDOMPosition startPos = new DOMPosition(newNode, 0);
        IDOMPosition endPos = new DOMRefPosition(endContainer, true);
        return new DOMRange(startPos, endPos);
  }
View Full Code Here

  /**
   * Update the status
   */
  protected void updateStatus() {
    DesignRange range = _viewer.getRangeSelection();
    DOMRange domRange = null;
    if (range != null) {
      domRange = new DOMRange(DOMPositionHelper.toDOMPosition(range
          .getStartPosition()), DOMPositionHelper.toDOMPosition(range
          .getEndPosition()));
      if (isApplied(domRange)) {
        this.setChecked(true);
      } else {
View Full Code Here

   */
  public static Text splitDomText(EditPart part, DesignRange range) {
    if (part instanceof TextEditPart) {
      Text textNode = (Text) part.getModel();

      DOMRange domRange = DOMRangeHelper.toDOMRange(range);
      IDOMPosition start = domRange.getStartPosition();
      IDOMPosition end = domRange.getEndPosition();
      int domTempStartOffset = computeOffset(start, textNode);
      int domTempEndOffset = computeOffset(end, textNode);

      int domStartOffset = Math.min(domTempStartOffset, domTempEndOffset);
      int domEndOffset = Math.max(domTempStartOffset, domTempEndOffset);
View Full Code Here

TOP

Related Classes of org.eclipse.jst.pagedesigner.dom.DOMRange

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.