Page 1 of 1

User intercation in custom protocol handler

Posted: Mon Sep 14, 2009 4:17 pm
by sijomon
I don't believe what I am about to describe is possible, but I'vbe been asked to try and implement it anyway, so a definative answer from you guys would be great.

I have a custom protocol handler that loads a file via a webservice when oxygen is opened with an appropriate URL. When the file is saved the custom protocol handler attepts to write the content back to the webservice. This will sometimes fail, e.g. if the server has gone down between openeidn and saving ghrt edocument. In these casees the handler creates a temporary local file and saves the updated document here. If the same document is later opened from the web service the the content of this local file is used by preference. This all worksa fine and has ssuccesfully be through test.

The users have now requested that when this local file is created, or used when opening a document, that a warning dialog be shown to the user. I don't believe that this is possible; can you either confirm this or give me some idea how I might go about it?

Many thanks,

Simon.

Re: User intercation in custom protocol handler

Posted: Tue Sep 15, 2009 4:01 pm
by sorin_ristache
Hello,

Just create the dialog (probably you work with JDialog instances or instances of a subclass of JDialog) and display it as a Java dialog. Did you try that and it did not work? Of course it will not have the Oxygen frame window as parent frame but it will be a Java warning dialog which the user will see on screen.

It is possible to set the Oxygen frame as parent of your Java warning dialog but it is kind of a hack (because the Oxygen plugin API does not pass the Oxygen window reference to the plugin - we will add this enhancement in a future version): implement also a General plugin or a Document plugin where you have access to the Oxygen window (the methods GeneralPluginContext.getFrame() and SelectionPluginContext.getFrme()) and pass the reference to this window to the custom protocol plugin through a shared static field of a class. Anyway we will consider passing the Oxygen window reference to custom protocol plugins through the plugins API.


Regards,
Sorin

Re: User intercation in custom protocol handler

Posted: Wed Sep 16, 2009 11:53 am
by sijomon
Thanks for the answer, clear and concise as allways.

I just assumed that without a context (parent window) something ugly would happen when I tried to display the JDialog - I guess that'll teach me for not just trying things out.

Thanks Again.

Re: User intercation in custom protocol handler

Posted: Tue Feb 09, 2010 1:37 pm
by sorin_ristache
Hello,

Starting with the next version (11.2) you can implement a WorkspaceAccessPlugin that will allow getting a reference to the Oxygen frame. Other solution which works also in current version (11.1) is iterate through the opened frames using java.awt.Frame.getFrames(). Usually there is only one frame visible which is the Oxygen frame.


Regards,
Sorin

Re: User intercation in custom protocol handler

Posted: Mon Feb 22, 2010 5:32 pm
by sijomon
Thanks for the update.