Jul 12, 2012

Eclipse: Meet the New Workspace–Same as the Old Workspace

 

When you create a lot of projects under Eclipse you'll probably eventually find you want to have more than one workspace. Sometimes when you upgrade to a new version of Eclipse (like to Juno) you might decide that is a good time to start a fresh workspace. The problem is, if you're like me, you're mostly interested in cleaning out the old projects. You like your customized fonts, colors, key bindings, external tools etc. Here are a couple of tips on making life a little easier when creating a new workspace.

If you find this article helpful check out my Eclipse Guided Tour course on Pluralsight. I’m currently working on part 2 which should be released in December of  2013.

Preferences

  1. In the old workspace, use File->Export and in the dialog that results  open the General->Preferences option as shown in the first image below. Hit Next and in that dialog select all preferences and browse to a location to save those preferences (see second image).
    imageSNAGHTML8abb84
  2. In your new workspace, you'll use File->Import and open the same General->Preferences item and click Next.In the dialog, you then select Import All and browse to where you saved your preferences in step 1. (If you want to save your current new workspace settings feel free to export them to a file before importing the old settings. This way you can get back to a clean install slate if it's ever needed). SNAGHTML9f2148
  3. Alternately many settings are stored in the workspace under the .metadata\.plugins\org.eclipse.core.runtime folder. You'll find a directory called .settings that you can just copy from the old workspace into the new workspace. When I use this method, I prefer to rename my original .settings to orig.settings just in case I ever need it.

    External Tool Configurations

  4. If you've painstakingly set up some external tools (like Lint) you don't have to go through that process again either. Like application run/debug configurations, external tools are just another form of a launch configuration and they too can be copied from the old workspace directory in the new workspace directory. You'll find your launches in the old workspace directory under .metadata\.plugins\org.eclipse.debug.core\.launches. You can just pick and choose the .launch files you want to copy over. Your launch configurations should be easily recognizable: for example if you had an external tool configured to read "Lint Current File", you should see a corresponding Lint Current File.launch file.

And of course if you want to copy over some of the existing projects into the new workspace the same File->Import dialog has an option under General named Existing Projects into Workspace, that will be your friend. In the second dialog don't miss the Copy projects into workspace check box that will copy the project into your new workspace. If you don't select that it will keep all the old files in their original location in the old workspace and just let you use those files from the new workspace.

About Me

My photo
Tod Gentille (@todgentille) is now a Curriculum Director for Pluralsight. He's been programming professionally since well before you were born and was a software consultant for most of his career. He's also a father, husband, drummer, and windsurfer. He wants to be a guitar player but he just hasn't got the chops for it.