How to edit .xml.cfm files in Eclipse
In this post I’ll explain how to assign an Eclipse editor to a specific file by name.
Why is this necessary? This blog is running on Machblog Beta 2. Machblog obfuscates the the MachII configuration file by adding a .cfm extension to the file, so it ends-up being mach-ii.xml.cfm. This technique is highly effective, simple and widely accepted. Perfect right? Almost, there’s a fly in the ointment and you’ll see it when you attempt to edit the file in Eclipse.
Until today editing an XML file disguised as a CFM file in Eclipse was a little tricky because Eclipse (like most IDE’s) maps the file extension to the editor, so in this case Eclipse tries to use CFEclipse to edit an XML file. The result (since CFEclipse doesn’t do XML) is a plain old editor with no syntax highlighting and no code insight etc. etc.
Now admittedly this is not a huge problem, more of an annoyance really. Enough of one that today I got to thinking there must be a way, and there is.
In the Eclipse file association editor you can map an entire file name to an editor. So in my case I mapped mach-ii.xml.cfm to the Aptana XML Editor. Re-opened the file and whalla it worked! I tried mapping *.xml.cfm but that didn’t work for some reason. Click on the pic above and you’ll get the gist of what I did.
Enjoy!
[Update]
Brian Kotek Posted the following comment on 3/1/07
“You should also just be able to add another editor to the associated editors list for .cfm files, and then when you open the file instead of double clicking it, right click, choose open with, and choose the XML editor.”
Great blog. I like layout!!!!