Controlling layout of editing windows

Post here questions and problems related to oXygen frameworks/document types.
peterls
Posts: 16
Joined: Fri Mar 20, 2015 2:29 pm

Controlling layout of editing windows

Post by peterls »

I'm writing a workspace access plugin that needs to open and display two documents side by side when you press a button. The result should look like this:

Image

But when I use Workspace.open() to open my two documents, I can't specify a screen location or position for the editing window, so they'll just open in the same area (under two tabs).

Is there any way to affect the initial layout of these windows? I don't need to stop users changing it afterwards, I just want to get a nice initial layout.
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: Controlling layout of editing windows

Post by Radu »

Hi,

I'm afraid we do not have API for this.
As a possible (not so elegant) workaround:
In the Window menu there is a "Tile Editors Vertically" action. You could try to gain access to it and call it programmatically after you have opened the two files.
To gain access to it you can set a menu bar customizer StandalonePluginWorkspace.addMenuBarCustomizer(MenuBarCustomizer) and when it gets called you can gain access to the main JMenuBar, navigate the hierarchy swing components, find the menu item which corresponds to the action and obtain the action.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
peterls
Posts: 16
Joined: Fri Mar 20, 2015 2:29 pm

Re: Controlling layout of editing windows

Post by peterls »

Hi Radu,

I've tried the workaround and it works perfectly. As you say, it isn't elegant (it relies on the text of the menu item) but it's stable enough for my needs.

Thanks,
Peter
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: Controlling layout of editing windows

Post by Radu »

Hi,

Just to update this thread, in Oxygen 18.0 we added API:

ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace.getActionsProvider()

which allows access to global actions, including the one for tiling editors.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply