24.08.2015 Views

Oxygen XML Author plugin 13.2.0

Oxygen XML Author plugin 13.2.0

Oxygen XML Author plugin 13.2.0

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Author</strong> Developer Guide | 210Note: The Javadoc documentation of the <strong>Author</strong> API used in the example files is available on the <strong>Oxygen</strong> <strong>XML</strong><strong>Author</strong> <strong>plugin</strong> website. Also it can be downloaded as a zip archive from the website.package simple.documentation.framework.extensions;/*** Specific editing support for SDF documents.* Handles typing and paste events inside section and tables.*/public class SDFSchemaAwareEditingHandler implements<strong>Author</strong>SchemaAwareEditingHandler {Typing events can be handled using the handleTyping method. For example, theSDFSchemaAwareEditingHandler checks if the schema is not a learned one, was loaded successfully and SmartPaste is active. If these conditions are met, the event will be handled./*** @seero.sync.ecss.extensions.api.<strong>Author</strong>SchemaAwareEditingHandler#handleTyping(int,char, ro.sync.ecss.extensions.api.<strong>Author</strong>Access)*/public boolean handleTyping(int offset, char ch, <strong>Author</strong>Access authorAccess)throws InvalidEditException {boolean handleTyping = false;<strong>Author</strong>SchemaManager authorSchemaManager =authorAccess.getDocumentController().get<strong>Author</strong>SchemaManager();if (!authorSchemaManager.isLearnSchema() &&!authorSchemaManager.hasLoadingErrors() &&authorSchemaManager.get<strong>Author</strong>SchemaAwareOptions().isEnableSmartTyping()){try {<strong>Author</strong>DocumentFragment characterFragment =authorAccess.getDocumentController().createNewDocumentTextFragment(String.valueOf(ch));handleTyping = handleInsertionEvent(offset, new <strong>Author</strong>DocumentFragment[]{characterFragment}, authorAccess);} catch (<strong>Author</strong>OperationException e) {throw new InvalidEditException(e.getMessage(), "Invalid typing event: "+ e.getMessage(), e, false);}}return handleTyping;}Implementing the <strong>Author</strong>SchemaAwareEditingHandler gives the possibility to handle other events like: thekeyboard delete event at the given offset (using Delete or Backspace keys), delete element tags, delete selection, joinelements or paste fragment.Note: The complete source code can be found in the Simple Documentation Framework project, included inthe <strong>Oxygen</strong> <strong>Author</strong> SDK zip available for download on the <strong>Oxygen</strong> <strong>XML</strong> <strong>Author</strong> <strong>plugin</strong> website.Configuring a Content Completion HandlerYou can filter or contribute to items offered for content completion by implementing thero.sync.contentcompletion.xml.SchemaManagerFilter interface.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!