Code: Select all
int selStart = authorAccess.getEditorAccess().getSelectionStart();
int selEnd = authorAccess.getEditorAccess().getSelectionEnd();
if ( selEnd != selStart )
{
System.out.println("Adding processing instruction.");
//String fragmentStart = "<?oxy_insert_start?>";
//authorAccess.getDocumentController().insertXMLFragment(fragmentStart, selStart);
//String fragmentEnd = "<?oxy_insert_end?>";
//authorAccess.getDocumentController().insertXMLFragment(fragmentEnd, selEnd);
String fragment = "<?oxy_insert_start?><?oxy_insert_end?>";
authorAccess.getDocumentController().surroundInFragment(fragment, selStart, selEnd );
}
The surroundInFragment code doesn't generate any errors, but no PI's are added.[Document]:Found insert processing instruction without an end.
[Document]:Ignoring end processing instruction for insert change tracking which does not have a start.