I've been using Eclipse for a long time, but it was only recently that I discovered the power of multiple workspaces. I feel like I should've learned this a long time ago.. but better late than never I guess!
I've never really explored the concept of the Eclipse workspace. To me, it was just the directory path that you had to specify at startup. The real meat-and-potatoes were the projects that were created in the workspace, so why care about the workspace itself?
If you're anything like me, you've always worked with a single workspace and a lot of projects. I would create a new Java project for each application I was working on. I would have CFEclipse projects along side of those. I would have ActionScript projects living right next door as well. All in all, at a single point in time I probably had 40 or 50 different projects in my workspace.
Now, this isn't really a bad thing. I was still able to be productive, though there was a lot of project opening and closing going on, and switching between projects was a bit of a task. It's no secret that when using Eclipse, you close the projects that you're not working with to save resources. I was accustomed to working like this, so it really wasn't a big deal.
Enter Flex / Java hybrid projects.
Following my typical workflow, I had a Flex / Java hybrid project that I was working on. I first created a Java project, and made a "flex" subdirectory where the .mxml and class files were held. This gave me code hinting for the back-end Java code, and with ASDT, the code hinting was "good enough" for the ActionScript code. Trying to build the project was a different story, and required a bit of ANT magic to compile everything and get all of the files where they needed to be. During the development cycle, when we switched from ASDT to FDT, it was clear there was a problem. Trying to have back-end code managed via the JDT coupled with front-end code edited via FDT, things just weren't working. They were mixing like oil and water.
The solution? Create 2 projects of course! One for the back end code, and one for the front end code. The problem? My project list continued to grow. Ideally I wanted a way to just focus on these 2 related projects at one time.
Enter the workspace.
I finally realized how powerful the workspace concept was. Each workspace houses a collection of projects, so it was determined that creating multiple workspaces was a good way to get organized. I created a new workspace, specific to the client the project was, and created two projects – one for the front end and one for the back. They each had their own build.xml files to manage building, and the new layout made FDT work extremely well (by giving it it's own project).
So now, whenever I wanted to work on this particular application, I just switched the workspace. Whenever I start a new application for a client, I automatically give them their own workspace. Whenever I start a new "for fun" application, I use my "Playground" workspace. Switching between different projects is no longer a hassle – instead of toggling open / close, and trying to find the right project to work with, I just switch workspaces entirely. I've been much more organized since I've been using multiple workspaces.
I can't believe I didn't know about this 2 years ago.
Anyway, to set up a new workspace (or switch between them), select File -> Select Workspace. Enter the path to a workspace. If the workspace already exists, it will be opened (and your project list will be updated). If no workspace exists at the location, a new workspace will be created (and the project list will be empty). Piece of cake! If you'd like to start Eclipse with a certain workspace, you can use the –data argument to pass the location of the workspace: eclipse.exe –data c:\development\workspaces\Client1Workspace
As an aside, this also makes sharing projects easier with a team. In my latest project, we put all of the eclipse project files under version control. All a new developer needs to do is check out the code from the repository, create a new workspace, and then "Import existing projects into workspace." Two or three clicks later, all of the projects are set up with correct project references and such, and the new developer is ready to dive in with the code instead of fumbling around trying to set up the projects.
Again, I can't believe this never occurred to me 2 years ago. Better late than never I guess… :-)