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 TypeMethodDescriptionvoidindentSection(int startOffset, int endOffset) Indents the give section of the document.voidinsertXMLFragment(String xmlFragment, int caretOffset) Insert an XML fragment at the caret location with indent.voidinsertXMLFragment(String xmlFragment, String xpathLocation, RelativeInsertPosition relativePosition) Insert an XML fragment relative to the node identified by thexpathLocationand according with therelativePosition.
-
Method Details
-
insertXMLFragment
void insertXMLFragment(String xmlFragment, String xpathLocation, RelativeInsertPosition relativePosition) throws TextOperationException Insert an XML fragment relative to the node identified by thexpathLocationand according with therelativePosition. 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_FIRSTorAuthorConstants.POSITION_INSIDE_LAST.- Throws:
TextOperationException- Unable to insert the fragment.
-
insertXMLFragment
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
-
indentSection
Indents the give section of the document. Indents each line from the section according to the XML structure.- Parameters:
startOffset- The start offset of the section.endOffset- The end offset of the section. Inclusive.- Throws:
TextOperationException- Unable to indent the section.- Since:
- 28.0
**************************************
EXPERIMENTAL - Subject to change
**************************************
Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.
-