Controlling layout of editing windows

Post here questions and problems related to oXygen frameworks/document types.
peterls
Posts: 9

Controlling layout of editing windows

Wed Oct 14, 2015 2:54 pm

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: 5582

Re: Controlling layout of editing windows

Wed Oct 14, 2015 3:19 pm

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: 9

Re: Controlling layout of editing windows

Wed Oct 14, 2015 4:01 pm

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: 5582

Re: Controlling layout of editing windows

Thu May 05, 2016 9:37 am

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

Return to “SDK-API, Frameworks - Document Types”

Who is online

Users browsing this forum: Bing [Bot] and 0 guests