Monday, May 17, 2010

The Preference Recorder

Earlier in the week we announced the release of the Workspace Mechanic for Eclipse on the Google Open Source Blog. This is a tool we have used inside Google for a couple of years, and with a bit of rewriting, made most of it available via open source. (We'd like to get the last piece of it out there, if more than anything, as an idea of what you can do with the Workspace Mechanic for Eclipse.) But this blog post isn't really about what we haven't released, it's about what we wrote specifically for the public release: the Preference Recorder.

This is a nice feature, and I don't want to underscore its usefulness. It'll probably help to think of it like an office suite's macro recorder -- turn it on, it listens to what you do, turn it off, and it builds a nice macro that recreates your steps. Same thing with the Preference Re: turn it on, it listens to preference changes. Turn it off, and it builds a nice file that recreates your steps!

One of the most common uses of the Workspace Mechanic for Eclipse is to propagate preference changes among workspaces.  Do parts of this sequence of events sound familiar?
  1. File > Export > Preferences
  2. Save to /tmp/first
  3. Window > Preferences
  4. Change preferences
  5. File > Export > Preferences
  6. Save them to /tmp/second
  7. $ diff /tmp/first /tmp/second > /tmp/delta.epf
  8. Tweak /tmp/delta.epf until it looks like you want. This includes adding preference metadata to match the format required for preference tasks.
What a pain!

So we wrote the Preference Recorder. It's much simpler!
  1. Right-click the Workspace Mechanic trim widget
  2. Preference Recorder > Start Recording
  3. Window > Preferences
  4. Change preferences
  5. Preference Recorder > Stop Recording
  6. Use dialog to select which preferences you actually want to export.

It'll spit the file out in a way that is compatible with the Workspace Mechanic, but heck, even if you don't want to use it to write tasks, it's a nice way to track your changes.

No comments: