Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 997
Jeff Axelrod Avatar asked Jan 05 '12 23:01

Jeff Axelrod


1 Answers

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.

like image 72
pwes Avatar answered Oct 11 '22 19:10

pwes