Thesing, Stephan wrote:
>  
> I want to add an extension to XMLMind for DocBook editing that does the
> following:
>   Whenever the document changes (text typed/deleted, nodes
> added/removed/changed), etc, I want to add the attribute "revisionflag"
> to all affected DocBook elements.
>    
> The "DocumentLIstener" interface should provide the necessary methods.  
> My question is, how to register a DocumentListener from an extension to
> XMLMind in DocBook mode?
>  

--> First, you need to register an OpenedDocumentHook with XXE.

See
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmleditapp/kit/OpenedDocumentHook.html

See
http://www.xmlmind.com/xmleditor/_distrib/doc/gui/openedDocumentHook.html

In order to do this edit attached customize.xxe_gui file, then copy it
anywhere inside one of the two addon/ directories of XXE.

* Then, your custom OpenedDocumentHook must detect that it is a DocBook
file which is being created or opened. Use
OpenedDocument.getConfiguration().getName() to detect this.

See
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmleditapp/kit/OpenedDocumentHook.html#documentCreated(com.xmlmind.xmleditapp.kit.OpenedDocument,%20com.xmlmind.xmleditapp.kit.HookStatus)

See
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmleditapp/kit/OpenedDocumentHook.html#documentOpened(com.xmlmind.xmleditapp.kit.OpenedDocument,%20com.xmlmind.xmleditapp.kit.HookStatus)

See
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmleditapp/kit/OpenedDocument.html#getConfiguration()

See
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmleditapp/config/Configuration.html#getName()

* Finally, add your custom DocumentListener to the underlying Document
of the OpenedDocument.

See
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmleditapp/kit/OpenedDocument.html#getDocument()

See
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xml/doc/Document.html#addDocumentListener(com.xmlmind.xml.doc.DocumentListener,%20boolean)



--> DocumentListeners are not intended to contain code which modifies
the document. They are meant to let some code *observe* the
modifications (e.g. MarkManager, UndoManager, etc).

If you want to modify the document, please do not do it directly from
within the code of your custom DocumentListener. Instead, do it using
SwingUtilities.invokeLater (possibly after merging multiple edits such
as those between beginEdit/endEdit or consecutive character insertions
or deletions).



--> Please note that we cannot help you more than we already did in this
email.

What you want to do is quite complex. Helping you more would force us to
first do a similar development, which is out of question.

If what you'll do causes XXE to become very slow or does not work
reliably or does not work at all (which I hope will not be the case),
please double-check, then triple-check what you did, before submitting
further support requests.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: customize.xxe_gui
Type: text/xml
Size: 650 bytes
Desc: not available
Url : 
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20091216/1609f085/attachment.xml
 

Reply via email to