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.
Dropbox
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.
Syncing
A) Creating the shared snippets directory in your dropbox
- Create a new directory in your dropbox folder, and call it “CFEclipse Snippets” or “CFSnippets” or whatever.
- Open CFEclipse (and CFBuilder if applicable).
- 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 keycombos.properties file
- Cut all of those files and paste them into your new Snippets dropbox directory
B) Pointing CFEclipse to the new snippets location
- If you haven’t done so yet, remove the snippets from the previous CFEclipse snippets location
- 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.
- Copy the path to your dropbox snippets directory into your clipboard
- Go to the CFEclipse window – preferences – cfeclipse preference page and paste the new snippets location into your dropbox snippets location
- Back in the Snip Tree View, hit the refresh button again. Your snippets should now show up.
- 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
CFBuilder
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.
-Marc