Can I save/restore my split-window layout in the Eclipse Java editor?
Asked Answered
L

2

10

I like to use Eclipse's Java editor feature that allows the me to split the editor window into several panes so I can look at multiple files at once.

Sample split window layout

Often the layout of the splits is context dependent. Ideally I'd like to be able to save the layout itself as well preserve which files were open. IntelliJ IDEA supports saving the complete context including split window layouts.

I am already familiar with and use the Mylyn task context save/restore. In fact, the Mylyn task restore actually destroys and clears the split-window arrangement upon task switch. There's a five-year-old Mylyn bug report for this defect.

It seems that the save perspective feature also doesn't save the pane layout. Is there a way to do this with or without a plugin?

Lavinia answered 5/1, 2012 at 23:21 Comment(0)
G
2

General answer: probably it's possible.

Open editors and UI settings are kept in <WS>/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml path, in great part. As you can see it's kept in a place independent of the installed plugins, so you can even restore the layout when there are no plugins responsible for opened editors (it happens to me often, as I share one workspace between many Eclipse configuration).

Skimming through the Eclipse sources, I see this file being accessed from org.eclipse.ui.internal.Workbench, in restoreState() (reading) and in recordWorkbenchState()+saveMementoToFile() (writing). So reproducing this functionality in a separate plugin and reading/writing to a different (profile) file should be enough for basic usage.

Generate answered 12/1, 2012 at 11:43 Comment(2)
Thanks for looking into this in so much detail. I didn't mean that I wanted to write a plugin, but +1 for the effort! Maybe someone else will come across this and develop a plugin given the info.Lavinia
No problem, it's always a good way to kill the time learning something new. :)Generate
P
0

As far as I know, this isn't possible without using some sort of plugin. I frequently work with multiple files and split them like you do, but as I understand how it works, the layout remains so long as there is a file in that pane.

When you open a new editor and "split" the editor area (drag the tab for the editor to an edge of the editor area), Eclipse opens the editor in a new "editor pane". You can do this a number of times, as you've shown in your picture.

I think the problem with your idea is when all the editors are closed, then try to open a new item, which editor pane should it open in? Currently, you have a split pane view with files already open and try to open a new file, it opens in the last pane that had focus.

It sounds like a really good idea and I would suggest making a enhancement ticket on Eclipse to add this functionality.

Pyrography answered 10/1, 2012 at 20:43 Comment(1)
There is already a problem report for it as linked to in the question. It's more than an enhancement request, as switching contexts destroys the split screen setup. If you know of a plugin that does this, please post it in the answer.Lavinia

© 2022 - 2024 — McMap. All rights reserved.