Sharing your CFEclipse / ColdFusion Builder Snippets across multiple installs

Thursday, December 24, 2009

As I’ve written previously, I rely heavily on snippets when working with CFEclipse. One problem I’ve always encountered, however, is keeping snippets synchronized across multiple Eclipse installations. Typically, this problem manifests when trying to keep them sync’d between my laptop, my work computer, and my PC at home. Recently, this problem has further been exacerbated by ColdFusion Builder. Not only do I want to keep my snippets sync’d between multiple installs of CFEclipse, but I want the same snippets applied to CFBuilder, as well.

Fortunately, this is a very easy to solve problem.


The first step is getting yourself a Dropbox account. Dropbox is a way to share files seamlessly across multiple computers. You’ll want to install dropbox on all your target machines.


A) Creating the shared snippets directory in your dropbox

  1. Create a new directory in your dropbox folder, and call it “CFEclipse Snippets” or “CFSnippets” or whatever.
  2. Open CFEclipse (and CFBuilder if applicable).
  3. Go find your existing CFEclipse or CFBuilder extensions. In CFEclipse, you get there by going to window – preferences – CFEclipse. The Snippets install directory field will be there. Copy that path and go to it on your machine. It’ll contain a number of folders and a file
  4. Cut all of those files and paste them into your new Snippets dropbox directory

B) Pointing CFEclipse to the  new snippets location

  1. If you haven’t done so yet, remove the snippets from the previous CFEclipse snippets location
  2. Open the Snip Tree View in CFEclipse and hit the “refresh” button. Your snip tree view should now be empty since there are no snippets there. This is an important sanity check… don’t skip it.
  3. Copy the path to your dropbox snippets directory into your clipboard
  4. Go to the CFEclipse window – preferences – cfeclipse preference page and paste the new snippets location into your dropbox snippets location
  5. Back in the Snip Tree View, hit the refresh button again. Your snippets should now show up.
  6. From now on, when you add or edit snippets, they’ll be modified in the dropbox location

Other Installs

For all your other installs – different versions of eclipse, different machines, whatever – you just follow the same steps as above from Section B. The bottom line is that if you want to sync snippets, you point all your installs to the same snippets location. Dropbox handles the magic of performing the actual synchronization


Thus far, I’ve been talking about CFE only. Fortunately, CFBuilder uses the same model and code as CFE. So to get CFB working with the shared snippets, simply open CFBuilder, go to window – preferences – coldfusion – Snippets, and paste your shared snippets directory into that field. Hit Save, go back to CFB, and refresh your snip tree view

Voila… snippets synced!


*Note – On some of my Eclipse installs, I had to remove the snippets from the previous/original snippet location before it would recognize the new snippets location. YMMV.



Raymond Camden said...

Pardon the french, but DAMN good tip here! Thank you. I hated constantly updating my snippet paths with every new build. Thank you, thank you, thank you!

Marc Esher said...

Thanks Ray! I'm humbled.

RDBetz said...

Thank you! Excellent tip. Funny thing is, I just installed Dropbox on all my machines for a totally different purpose. Now it will be even more useful.

Marc Esher said...

RDBetz, I had a similar experience. I installed dropbox after reading Joel Spolsky's article on using dropbox and passwordsafe together ( as a passwordsafe user, it was "the missing link". Now, dropbox has been more useful in ways that I never originally conceived of.

bill shelton said...

great post, marc! i hadn't considered this for passwordsafe or snippets, but it makes sense. alternatively ,though dropbox is available for linux, there's also Ubuntu One :

Jim said...

Great post Marc! If you Google around you can find several really good "alternative uses for Dropbox" type posts.

A few I do - I keep a 'portable' wiki (TiddlyWiki) on it to keep stuff organized.

I keep my main Autohotkey script there (haven't used Eclipse snippets in awhile).

I store my wallpaper there.

I keep several other 'portable' apps there just in case I'm on an different computer for easy access...

It's a great utility!!

Marc Esher said...

Much appreciated, Jim. I will indeed search around for other uses for Dropbox.

I do in fact keep my main Eclipse install in dropbox. It works OK, but damn... it's noisy! It's not uncommon for me to see "6000+ files have been updated..." messages from Dropbox after I update Eclipse, install new plugins, etc. Hell, just Opening and closing Eclipse results sometimes in dozens if not hundreds of modified files. This kind of heavy churn would be burdensome on machines with slower CPUs

GoWestWeb said...

Excellent, thanks so much. This is something I've wished I had for a while... now I do!