CFEclipse and ColdFusion Builder give you the same snippet functionality you know and love from ColdFusion Studio. When you download MXUnit, you get a directory of snippets (and key combos) that you can apply to your own snippets. These snippets live in mxunit/eclipse/snippets. You can copy them manually, or use a bundled ANT task.
You can read my writeup on why I love snippets here . Matt Gifford's is worth a read, too.
Step 1: Where do your snippets live?
- In Eclipse:
- CFEclipse: go to Window -- Preferences -- CFEclipse
- ColdFusion Builder: Window -- Preferences -- ColdFusion -- Snippets
- Copy the path to the snippets directory
Step 2: Manually Copy the snippets
- open that path on your file system
- In a separate window, open the mxunit/eclipse/snippets/ directory on your file system. Copy the contents of that directory into the snippets directory that you just opened in #3
- optionally, copy the contents of snippets/mxunit/keyCombos.properties into your existing keyCombos.properties file
Step 2 (optional): Use ANT to copy them for you
The first time you do this, it'll be a two step process. Step 1 has you creating a 1-line properties file; Step 2 has you executing the ANT task
- In mxunit/eclipse/snippets, create a file named copysnippets.properties
- Populate it like so: snipdir.options=c:/my/path/to/cf/snippets, where that snippets directory is the value of your snippet path
- Right click on "copysnippets.xml" and select "Run as ANT build"
- This will copy the mxunit snippets into your existing Eclipse snippets directory, and it will copy the mxunit keycombos into your keycombos file. It will NOT overwrite your existing key combos. It will make a backup of your keycombos file.
| The paths must be forward slashes! On my computer, the path is: snipdir.options=C:/Users/Marc/Documents/My Dropbox/CFEclipseSnippets this can be a comma-separated list, too, just in case you have multiple snippets locations |
Step 3: Refresh your Snip Tree View
- Open the Snip Tree View
- Click the Refresh Icon
- You'll now have an mxunit directory with a bunch of snippets
Step 4: Give it a shot
- Create a scratch file, call it "MyTest.cfc" or some such thing
- In that file, type "mxunit", and then hit "ctrl-j", which is the default key sequence to execute a snippet insertion
- Your file will now have a test case stub.
| Explore the different packages and snippets in the "mxunit" directory in the Snip Tree View to see what other snippets are available! |
Step 5: Share your snippets with your other computers
If you work on more than one computer -- perhaps a computer at home, or a laptop, or a work machine -- and you wish to share all your snippets amongst those machines, give this a read
Add Comment