[oXygen-sdk] Implementation of AuthorExtensionStateListener

Alex Jitianu alex_jitianu at sync.ro
Wed Jan 22 04:55:13 CST 2014


Hi,

An AuthorListener is intended to receive notifications about the changes 
in the author node model. Do you want an event when the entire 
application is launched or an event every time a document is open in an 
editor in a running Oxygen Author application? Both could be achieved 
very easily using plugin level API: [1][2]. You could create a plugin 
for Oxygen standalone and use the Eclipse specific plugin support to 
write a small plugin that gets these values from the user in an Eclipse 
environment. This plugin could save these variables using [3][4] so that 
the framework code could have access to them.

If you want to do it from the framework alone then you could just 
present this dialog on 
ro.sync.ecss.extensions.api.AuthorExtensionStateListener.activated(AuthorAccess). 
You might want to invoke this code on a 
javax.swing.SwingUtilities.invokeLater(Runnable) if the editor should be 
initialized before asking the user for those values. If the user must be 
asked once the you could use Oxygen built-in options storage support to 
store these values and the fact that you already asked the user for them 
[5][6].

[1] 
ro.sync.exml.plugin.workspace.WorkspaceAccessPluginExtension.applicationStarted(StandalonePluginWorkspace)
[2] 
ro.sync.exml.workspace.api.PluginWorkspace.addEditorChangeListener(WSEditorChangeListener, 
int)
[3] ro.sync.exml.workspace.api.PluginWorkspaceProvider.getPluginWorkspace()
[4] 
ro.sync.exml.workspace.api.PluginWorkspace.setGlobalObjectProperty(String, 
Object)
[5] ro.sync.ecss.extensions.api.AuthorAccess.getOptionsStorage()
[6] ro.sync.ecss.extensions.api.OptionsStorage.setOption(String, String)

Best regards,
Alex
-- 
Alex Jitianu
<oXygen/>  XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 22-Jan-14 5:53 AM, Nathan wrote:
> Hi,
>   I am using Oxygen 15's inbuilt DITA framework and I would like to 
> customize it by showing a Swing based form when Oxygen Author has been 
> opened. This form will be used to set custom variables which can then 
> be used later on.
>   I am planning to do this using the Author API, specifically the 
> AuthorExtensionStateListener interface (I saw a sample at 
> "http://www.oxygenxml.com/doc/ug-author/index.html#topics/dg-author-extension-state-listener.html" 
> in this regard). I presume the next step would be to register an 
> implementation of AuthorListener (or extend the 
> "AuthorListenerAdapter" class) within the activate method of the 
> implementation of AuthorExtensionStateListener interface.
>   My questions are as follows:
> a) Is this the best way to implement what I have in mind?
> b) There does not seem to be any Author window event which can be used 
> to popup the form. I see others for doctypeChanged(), documentChanged 
> etc here but nothing to record a opening-of-author event.
> I feel like I am missing something here and would greatly appreciate 
> some help. If there is a better way to do this, I am all ears. Just a 
> note, I cannot use plugins since this has to work for people who use 
> Oxygen Author standalone and those who use the Author plugin within 
> eclipse.
>
> My current code structure something like this...
>
> File 1:
>
> public class ditaAuthorExtensionStateListener implements 
> AuthorExtensionStateListener{
> ....
> ....
>
> public void activated(...){
> // Add author document listeners.
> ditaAuthorDocumentListener = new DitaAuthorListener();
> authorAccess.getDocumentController().addAuthorListener(ditaAuthorDocumentListener);
> }
> File 2:
> public class DitaAuthorListener implements AuthorListener{
>
> .....
> .....
> // I am stuck here since I do not find any method which is triggered 
> on opening Oxygen Author.
>
> Thanks a bunch!
> Nathan
>
>
> _______________________________________________
> oXygen-sdk mailing list
> oXygen-sdk at oxygenxml.com
> http://www.oxygenxml.com/mailman/listinfo/oxygen-sdk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.oxygenxml.com/pipermail/oxygen-sdk/attachments/20140122/1ae140db/attachment.html>


More information about the oXygen-sdk mailing list