User intercation in custom protocol handler

Having trouble installing Oxygen? Got a bug to report? Post it all here.
sijomon
Posts: 83
Joined: Wed May 20, 2009 1:18 pm

User intercation in custom protocol handler

Post 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.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: User intercation in custom protocol handler

Post 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
sijomon
Posts: 83
Joined: Wed May 20, 2009 1:18 pm

Re: User intercation in custom protocol handler

Post 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.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: User intercation in custom protocol handler

Post 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
sijomon
Posts: 83
Joined: Wed May 20, 2009 1:18 pm

Re: User intercation in custom protocol handler

Post by sijomon »

Thanks for the update.
Post Reply