Friday, March 19, 2010

A trick for managing workspaces within Eclipse

There are lots of ways to deal with the issue of multiple workspaces within Eclipse. The way I approach it is to have all of my workspaces live under /opt/workspaces and have them all available at the same time. This allows me to switch back and forth between projects easily. It does have a drawback however, but I've found a way around it and thats the topic of this post.

If you multiple workspaces open and you use the Cntrl-Shift-T class finder to navigate between classes you will be shown a list of with search results from all of the workspaces. Chances are you are only actually working in a single workspace at a time. Wouldn't it be great to only see results from the workspace you are actively working in?

There is a drop down arrow in the upper right corner of the Cntrl-Shift-T dialog. That brings up a "Select Working Set" dialog. Press "new" and then "Resource" to select just the project you are working on. From that point on your class searches will be limited to that project.

The one other step to do is in the Project Explorer select the project you are working on and from the right-click popup menu select "go into".

These two tricks let you have the best of both worlds, context that is limited to your current project along with trivial switching between projects.