Page 1 of 1

Controlling layout of editing windows

Posted: Wed Oct 14, 2015 2:54 pm
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.

Re: Controlling layout of editing windows

Posted: Wed Oct 14, 2015 3:19 pm
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

Re: Controlling layout of editing windows

Posted: Wed Oct 14, 2015 4:01 pm
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

Re: Controlling layout of editing windows

Posted: Thu May 05, 2016 9:37 am
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