Getting Friendly with Eclipse Workspaces

| 7 Comments | No TrackBacks

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… :-)

No TrackBacks

TrackBack URL: http://www.darronschall.com/mt/mt-tb.cgi/83

7 Comments

Hey man, thanks for the tip. I've used Eclipse for a long time too and I tend to create "working sets" to hide multiple projects, so my Flash Explorer is less cluttred focusing on one project at a time. Now I'll go ahead and use it together with different workspace!

Thanks.

/Johan

I dont like changing workingspaces.
Eclipse will restart each time. Which is slow. What you can do set multiple tabs and use one workspace. Use language Perspectives (Java, CFexlise, Flash etc..)

How often would you change workspaces during the day? I find myself doing it maybe once or twice daily... And even so, I don't mind the wait - it's less than 5 seconds on my computer.

From my experience, multiple workspaces keeps me organized, makes projects work together better, and makes sharing projects easier. Your mileage may vary, of course.

Hi Darron I was using the "working sets" approach but I think that switch between workspace could be another weapon in the eclipse organization arsenal :)

Hi Darron - was wondering if you have figured out how to configure all workspaces to user the same settings?

I find that with ever new workspace I open I have to re-configure everything.

Thanks

Melissa,

R.J.Larimer has a few suggestions for maintaining the workspace settings in this article (see Workspaces at the end); http://www.javalobby.org/java/forums/t18678.html

I'd also like to hear what Darron does.

Thanks

Hi Darron

Thanks for posting this, I could not find any information on creating a New workspace in the on-line help or the Flex PDF docs (though beta docs are not complete I know). I was looking for a New Workspace button or Menu choice.

Leave a comment



About this Entry

This page contains a single entry by darron published on January 17, 2006 1:00 PM.

Speaking at FITC 2006 was the previous entry in this blog.

How to Set up a Linux Server with Subversion and Trac is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Archives

OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.02