Interface TextDocumentController


@API(type=NOT_EXTENDABLE, src=PUBLIC) public interface TextDocumentController
Contains API for inserting XML content in certain places in the Text editing mode.
Since:
16.1
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    insertXMLFragment(String xmlFragment, int caretOffset)
    Insert an XML fragment at the caret location with indent.
    void
    insertXMLFragment(String xmlFragment, String xpathLocation, RelativeInsertPosition relativePosition)
    Insert an XML fragment relative to the node identified by the xpathLocation and according with the relativePosition.
  • Method Details

    • insertXMLFragment

      void insertXMLFragment(String xmlFragment, String xpathLocation, RelativeInsertPosition relativePosition) throws TextOperationException
      Insert an XML fragment relative to the node identified by the xpathLocation and according with the relativePosition. The inserted fragment is indented after being added to the document.

      After the operation the caret will be positioned in the first leaf of the fragment.

      Parameters:
      xmlFragment - The XML fragment.
      xpathLocation - The XPath location.
      relativePosition - The position relative to the node identified by the XPath location. Can be one of the constants: AuthorConstants.POSITION_BEFORE, AuthorConstants.POSITION_AFTER, AuthorConstants.POSITION_INSIDE_FIRST or AuthorConstants.POSITION_INSIDE_LAST.
      Throws:
      TextOperationException - Unable to insert the fragment.
    • insertXMLFragment

      void insertXMLFragment(String xmlFragment, int caretOffset) throws TextOperationException
      Insert an XML fragment at the caret location with indent. When the caret offset is inside an element tag (start element, empty element or end element) tries to place the caret inside the element's contents. If the element is empty, it tries to expand the element (eg: from <a/> to <a></a>) placing the caret between the tags. After insertion is done, the caret is placed after the inserted element.
      Parameters:
      xmlFragment - The XML fragment.
      caretOffset - The caret offset
      Throws:
      TextOperationException - Unable to insert the fragment.
      Since:
      21.0