Share Eclipse perspective layouts across multiple workspaces

Once you’ve configured Eclipse preferences to your heart’s content, you’ll often want to share those preferences across multiple workspaces. Now normally you can go to File > Export > General > Preferences to save your preferences to a properties file which you can then import into the other workspace. This will share settings such as your customised keyboard shortcuts, formatting, repository settings, etc.

But, for some reason, Eclipse doesn’t save perspective/window layouts, such as which views are open and where they are placed in the perspective. So you’ll find yourself spending another half hour configuring the window to the way you like it. After the 3rd workspace you need to create, this becomes frustrating and just wastes time.

Fortunately there are ways to save and restore these settings automatically. The first is to save the perspective into the preferences (currently only works in Eclipse 3, to be fixed in Eclipse 4) and the other is to use Eclipse’s Copy Settings feature when opening the other workspace. I prefer the first option, but I’ll mention the second option and when to use the one over the other.

Method 1: Save the layout as a new perspective

Note for Eclipse 4 users: This method only works in Eclipse 3. There is a bug open for Eclipse 4 and the current fix target is Eclipse 4.4. See Eclipse Bug 378811.An alternative in Eclipse 4 is to use the workaround suggested in the bug (copying workbench.xmi) but this is really clunky so hopefully this issue will get fixed soon.

However, this workaround doesn’t work when migrating from Eclipse 3 to 4. You’ll have to recreate your layouts in Eclipse 4 before sharing them with other version 4 workspaces. See this comment in the same bug.

The first method is to save the perspective layout as another perspective, then export the preferences file as normal. The saved perspective’s settings will be included in the preferences file. When you’ve updated the layout,  just resave and overwrite the perspective and export the preferences again.

To save your perspective, select Window > Save Perspective As… from the application menu. A dialog should popup (shown below), prompting you for a perspective name. Enter a name  that you’ll remember, eg. My Java or Debug Jack. Click Ok once you’ve entered a new name.

Note: You can choose to overwrite one of the default perspectives, eg. Java, without fear. However, I prefer to leave these intact, so always choose a new name, but you can choose whatever works for you.

Now you can go through the normal routine of exporting the preferences to a properties file via File > Export > General > Preferences. Then import the same  file in another workspace via File > Import > General > Preferences. All you now have to do is switch over to the perspective you saved and all your layout settings will be restored. If you overwrote one of the default perspectives, you may have to select Window > Reset Perspective… to restore the saved settings.

If you’ve chosen to create a new perspective, be sure to point your Run/Debug settings to the new perspective under Window > Preferences > Run/Debug > Perspectives. For example, if you made a new perspective based on the Debug perspective, then you’ll need to change references to the Debug perspective to the My Debug for launchers you use. Luckily this is only required once as these settings are also saved when you export preferences (at least since Eclipse 3.5).

Gotcha: I use fast views a lot, and for some reason the Fast View dock’s position isn’t restored automatically. But manually restoring this is as easy as moving the dock, so it’s not that bad. Toolbar settings aren’t saved either, but I haven’t tampered with these a lot anyway since I prefer using the keyboard and mouse gestures.

Method 2: Use Copy Settings

The other method of saving your window layout is to use the Copy Settings feature when switching to another workspace.

To use this feature, first open the workspace that contains your customised layout. Then select File > Switch Workspace > Other… which will open a dialog prompting you for an existing/new workspace. Select the workspace, then click the Copy Settings collapsible section. Select the Workbench Layout checkbox and click Ok. Your workspace will open and should reflect the customised layout of the previous workspace.

Here’s what the dialog looks like:

Which method should I use?

Well, as I said before, I prefer the first method for a number of reasons. If some of these apply to you then you might want to use the first method as well. Use this method if:

  • You want to share layout settings across workspaces on different machines, eg. work and home. This method is a lot more portable because you only need one single properties file.
  • You spend 90% of your time in 1 or 2 perspectives (eg. Java & Debug) then this method works well because you only have to manage those perspectives.
  • You make a lot temporary changes to perspectives that you don’t necessarily want shared. For example, if you’ve opened a number of views that you rarely use, you don’t want to clutter your new workspace with these views. I find that I have my “base” perspective layout, around which things will change depending on the context and I don’t want these to clutter my “base” layout.
  • You want to share preferences with a colleague/friend.

Use the Copy Settings method if:

  • You want to quickly create another workspace with the saved layout without having to export any preferences.
  • You have made a number of changes across many perspectives and you want to restore those settings.
  • You’re feeling lazy. With this method, Eclipse manages a lot more things, so it’s a bit easier to manage (in the short-term), but for the longer term, the first method is best.

Related Tips

Share This Tip

Support Eclipse On E

18 thoughts on “Share Eclipse perspective layouts across multiple workspaces

    • nevertheless method one seems not to work with eclipse Juno (eclipse 4.2). To bad, so there seems to be no solution to save and reuse your custom perspectives when you upgrade your IDE.

    • Thanks for the comment, Thomas. Although this works for Eclipse 3.x, it seems like Eclipse 4.2 (Juno) doesn’t export the perspective settings out to the preferences anymore. There’s already a bug for that – Eclipse Bug 378811.

      Hopefully they’ll add it to Eclipse 4 soon because the bug’s still open and one of the comments in the bug says, “…I’m re-targeting this defect towards providing he ability to have a separate location to store the UI Model…”

      Until then, as a manual workaround, you could copy over the existing workbench settings file that contains the changes to the new workspace. Copy [workspace_folder]/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi to the same location in the new workspace folder and restart Eclipse.

      It’s not ideal as won’t work when migrating from 3.x to 4.x and it will overwrite *all* UI workbench settings in the new workspace, including any UI changes you may have made. But at least it will work if both workspaces are on 4.2. Hope this helps you.

      I may add a note to the post to mention this so thanks for mentioning it.

    • If by “migration” you mean exporting from 3 to 4, then unfortunately this comment mentions that they won’t enable migration from 3.x to 4.x. I think the bug is only to enable you to at least export the perspectives from one 4.x workspace to another 4.x workspace, which you also can’t do.

      Still a good idea voting for it though. It does seem like a bit of an oversight.

  1. You should mention that the first option, saving the perspective, only works locally within the same instance of Eclipse. It does not actually save the perspective to the preferences file. It saves it within eclipse (in some other user setting file) and then you have to select it again with your new workspace. I found this because I was switching to a new machine and hoping I could use this method to transfer my perspective and preferences in one go.

    • Thanks anon. Please see the comment I made to Thomas about this not working in Eclipse 4.2. It does work across instances in 3.x though since I still use it all the time in 3.7.

    • I am trying to move laptop and going from Helios to Kepler (I don’t know what version numbers they are!) at the same time, and have been trying to get my perspectives to move. I don’t think it works, and, sadly have decided it will be quicker to just give up. I seem to recall having had the same problem 3 years ago last time I moved laptop!

    • Bad news, Rob. This is a bug in Eclipse 4 which is still open and will hopefully be fixed in 4.4. I’ve updated the post to highlight this. Until then, the only workaround seems to be to copy the workbench.xmi as suggested in the comments on this post and the Eclipse Bug 378811.

    • Hi Byron
      Thanks a lot for getting back to me.

      https://bugs.eclipse.org/bugs/show_bug.cgi?id=378811 was a good link.

      This article implies you could hack the xml at

      C:\Users\Owner\workspace\.metadata\.plugins\org.eclipse.ui.workbench\workbench.xml
      to manually copy in the Perspective you want. I think his might work
      if the Eclipse versions were the same on the two machines, but in my case Helios and Kepler seem quite different in the way they store things, so I really am giving up now 🙂

      My crude experimenting with a persepective called rob shows the Helios xml looks like this

      and the Kepler looks like this

      <children xsi:type="advanced:Perspective" xmi:id="_giVSxKmsEeOLop4GopIeGQ" elementId="org.eclipse.jdt.ui.JavaPerspective.rob"

  2. Clearly there is a bug with exporting and importing the perspectives from one version of Eclipse to Eclipse 4.2 and even from project X in Eclipse 4.2 to project Y in Eclipse 4.2.

    Here is my workaround in Eclipse 4.2.
    1. Set up your desired perspectives in project X.
    2. Exit Eclipse.
    3. Copy from project X .metadata/.plugin/org.eclipse.e4.workbench/workbench.xmi to project Y the same directory.
    4. Start Eclipse and the perspective should be available.

    • Thanks for that, jim9988. As I mentioned to Thomas, this method will copy over *other* workbench settings as well (not just perspectives) so should only be used if you’re sure you want to overwrite the previous settings. It’s not critical settings though and you can normally set them back quite easily.

  3. Pingback: How To Migrate Perspective Across Workspaces In Eclipse? | Click & Find Answer !

  4. My post should say:
    Helios xml looks like this
    <perspective editorAreaTrimState="2" editorAreaVisible="1" fixed="0" version="0.016"…
    <descriptor descriptor="org.eclipse.jdt.ui.JavaBrowsingPerspective" id="rob" label="rob…

Leave a Reply

Your email address will not be published. Required fields are marked *