Monday, July 07, 2008

Fixing Eclipse's Workspace Dialog: A Unix One-Liner in Only Three (Okay, Four) Lines


cd /Applications/eclipse_3_3/configuration/.settings
&& sed '/RECENT_WORKSPACES/d' org.eclipse.ui.ide.prefs
> org.eclipse.ui.ide.prefs.fixed
&& mv org.eclipse.ui.ide.prefs.fixed org.eclipse.ui.ide.prefs


I usually (heart) Eclipse, but sometimes I just want to smack it upside its virtual head. One of those times is when it's starting up and I change focus to some other app and start typing something and Eclipse at some point grabs focus and inserts whatever I thought I was typing somewhere else and prepends it to its "which workspace do you want to use?" dialog and promptly creates a new workspace with a name of whatever nonsense text ended up in the dialog box. You know?

So I now have this little bit of bash magic saved as zapEclipseWorkspaceSelection.sh in my home directory. The downside is that it zaps all of your prior workspace selections, not just the smack-Eclipse-upside-the-head ones. You could maybe modify it to, say, ask for input on what invalid workspace names it should delete. Not me, man. Subtlety is not one of my vices.

2 comments:

Loki said...

The one-liner would be
sed -i '/RECENT_WORKSPACES/d' /Applications/eclipse_3_3/configuration/.settings/org.eclipse.ui.ide.prefs

;D

David Rupp said...

I KNEW there was a way to do that in-place! Nicely done. :-)