Package org.eclipse.wst.xml.core.internal.provisional.document

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


    }
    if (position instanceof DOMRefPosition) {
      return toDesignRefPosition((DOMRefPosition) position);
    }
    do {
      IDOMNode container = (IDOMNode) position.getContainerNode();
      EditPart part = (EditPart) container.getAdapterFor(EditPart.class);
      if (part != null) {
        if (container instanceof Text) {
          String textData = ((Text) container).getData();
          String displayData = ((TextEditPart) part).getTextData();
          return new DesignPosition(part,
View Full Code Here


  public static DesignPosition toDesignPosition1(IDOMPosition position) {
    if (position instanceof DOMRefPosition) {
      return toDesignRefPosition((DOMRefPosition) position);
    }
    do {
      IDOMNode container = (IDOMNode) position.getContainerNode();
      EditPart part = (EditPart) container.getAdapterFor(EditPart.class);
      if (part != null) {
        if (container instanceof Text) {
          String textData = ((Text) container).getData();
          String displayData = ((TextEditPart) part).getTextData();
          return new DesignPosition(part,
View Full Code Here

      // the ADD/REMOVE
      // event here.
      return;
    }
    if (notifier instanceof IDOMNode) {
      IDOMNode node = (IDOMNode) notifier;
      // we need to refresh all CSS style adapter of node and its
      // children.
      EditPart part = (EditPart) node.getAdapterFor(EditPart.class);
      if (part instanceof SubNodeEditPart) {
        Node nodeForFigure = ((SubNodeEditPart) part)
            .getNodeForFigure();
        if (nodeForFigure instanceof IDOMNode) {
          refreshChildStyles((IDOMNode) nodeForFigure);
        }
      }

      // we need also find the nearest parent node that has editpart, and
      // refresh it.
      refreshContainingPart(node,
          eventType == INodeNotifier.STRUCTURE_CHANGED);

      part = (EditPart) node.getAdapterFor(EditPart.class);
      if (part != null) {
        ((IHTMLGraphicalViewer) part.getViewer()).clearSelectionRange();
      }
    }
  }
View Full Code Here

  private void refreshStyle() {
    List childParts = this.getChildren();
    for (Iterator iter = childParts.iterator(); iter.hasNext();) {
      EditPart part = (EditPart) iter.next();
      if (part instanceof ElementEditPart) {
        IDOMNode node = (IDOMNode) ((ElementEditPart) part)
            .getNodeForFigure();
        if (node != null) {
          refreshChildStyles(node);
        }
      }
View Full Code Here

      String prefix = node.getPrefix();

      if (result == null && prefix != null && prefix.length() > 0 && node instanceof IDOMNode) {
        // check position dependent
        IDOMNode xmlNode = (IDOMNode) node;
        TLDCMDocumentManager tldmgr = TaglibController.getTLDCMDocumentManager(xmlNode.getStructuredDocument());
        if (tldmgr != null) {
          List documents = tldmgr.getCMDocumentTrackers(node.getPrefix(), xmlNode.getStartOffset());
          // there shouldn't be more than one cmdocument returned
          if (documents != null && documents.size() > 0)
            result = (CMDocument) documents.get(0);
        }
      }
View Full Code Here

    for (Node child = target.getFirstChild(); child != null; child = child.getNextSibling()) {
      switch (child.getNodeType()) {
        case Node.TEXT_NODE :
          {
            IDOMNode text = (IDOMNode) child;
            int charOffset = validateTextSource(text);
            if (charOffset >= 0) {
              charOffset += text.getStartOffset();
              Segment errorSeg = new Segment(charOffset, 1);
              if (errorSeg != null)
                report(INVALID_CHAR_ERROR, errorSeg, text);
            }
            break;
          }
        case Node.COMMENT_NODE :
        case Node.DOCUMENT_TYPE_NODE :
        case Node.PROCESSING_INSTRUCTION_NODE :
        case Node.CDATA_SECTION_NODE :
          {
            IDOMNode tag = (IDOMNode) child;
            if (!tag.isClosed()) {
              Segment errorSeg = FMUtil.getSegment(tag, FMUtil.SEG_WHOLE_TAG);
              if (errorSeg != null)
                report(UNCLOSED_TAG_ERROR, errorSeg, tag);
            }
            break;
View Full Code Here

      indent = contraints.getFormatWithSiblingIndent();
      contraints.setFormatWithSiblingIndent(false);
    }

    boolean insertBreak = true;
    IDOMNode child = (IDOMNode) node.getFirstChild();
    while (child != null) {
      if (child.getParentNode() != node)
        break;
      IDOMNode next = (IDOMNode) child.getNextSibling();

      if (insertBreak && canInsertBreakBefore(child)) {
        insertBreakBefore(child, contraints);
      }
View Full Code Here

      // use parent indent for the end tag
      spaces = getBreakSpaces(parent);
    }
    else if (next.getNodeType() == Node.TEXT_NODE) {
      if (contraints != null && contraints.getFormatWithSiblingIndent()) {
        IDOMNode text = (IDOMNode) next;
        IStructuredFormatter formatter = HTMLFormatterFactory.getInstance().createFormatter(text, getFormatPreferences());
        if (formatter instanceof HTMLTextFormatter) {
          HTMLTextFormatter textFormatter = (HTMLTextFormatter) formatter;
          textFormatter.formatText(text, contraints, HTMLTextFormatter.FORMAT_HEAD);
        }
View Full Code Here

    Node prev = node.getPreviousSibling();

    String spaces = null;
    if (prev != null && prev.getNodeType() == Node.TEXT_NODE) {
      if (contraints != null && contraints.getFormatWithSiblingIndent()) {
        IDOMNode text = (IDOMNode) prev;
        IStructuredFormatter formatter = HTMLFormatterFactory.getInstance().createFormatter(text, getFormatPreferences());
        if (formatter instanceof HTMLTextFormatter) {
          HTMLTextFormatter textFormatter = (HTMLTextFormatter) formatter;
          textFormatter.formatText(text, contraints, HTMLTextFormatter.FORMAT_TAIL);
        }
View Full Code Here

  }

  protected INodeAdapter createAdapter(INodeNotifier target) {
    PageDirectiveAdapter result = null;
    if (target instanceof IDOMNode) {
      IDOMNode node = (IDOMNode) target;
      if (node.getNodeType() == Node.DOCUMENT_NODE) {
        result = getAdapterInstance(target);
      }

    }
    return result;
View Full Code Here

TOP

Related Classes of org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode

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.