Here's a question - how would you handle persistence in a ColdFusion Builder extension? Most extensions are "fire and forget" - they may have a few steps but in general the idea is - take some input, do some action, return some output. There are - however - times when you may want to remember stuff. For example, perhaps your extension has numerous options and you simply want to remember what the user picked last time. A while ago I released a component called builderHelper. This component wrapped up common tasks for extension developers and aimed to make working with the XML dialect of CFB extensions even simpler. Today I whipped up a super simple method of persistence. Any extension making use of builderHelper can store settings use name/value pairs. The name must be unique per extension and the value can be anything that is serializable by JSON:
<cfset helper.setStorageItem("prefs", {x=1})>
<cfset helper = createObject("component", "testingzone.builderHelper.builderHelper").init(ideeventinfo)>
<cfset prefs = helper.getStorageItem("prefs")>
<cfdump var="#prefs#">
In this code sample I initialize builderHelper with my ideeventinfo packet. I then ask for and dump a value called prefs. The first time I run this it will be blank. Then I set a value, in this case a struct with one key. The second time I run this particular extension it will get the structure back. A pretty trivial example but hopefully you get the idea.
You can download this code at the RIAForge project: http://builderhelper.riaforge.org/
Archived Comments
Since CF builder sits as a plugin in Eclipse, you may want to consider using the Eclipse API. It accounts for all of these specific issues plus it doesn't require the CF engine to work. The Eclipse API is a very well executed series of libraries, very thorough, and you can accomplish these things without producing anything that is "Mickey Mouse." Check it out, you'll be impressed.
How is any of this Mickey Mouse though? I don't doubt that the Eclipse API is nice - but it requires Java knowledge. One of the big benefits of CFB is that it allows CFML developers to use their _existing_ knowledge to build extensions to the IDE.
Yah but the cool thing is ColdFusion _is_ Java, right? But seriously, learn some differences in syntax and some new libraries AND remove the binding to the CF server and you're home free! Its a much better way to go. Oh yah, check out MXUnit's plugin for example.
I'm not opposed to learning anything new of course - but Java isn't on top of my list. I feel like I can do almost anything now - especially under CFB2.
@Eric,
I don't know all that much about Java or the Eclipse API; but, what I can say about the Builder / ColdFusion integration is that I love that I can re-purpose the skills that I already have. Also, since you are essentially connecting to a "web app", you can just about build and test a Builder Extension outside of the context of the Eclipse context. And, since it's a web app, you can take full advantage of web standards, CSS, AJAX, and all the other awesome stuff that has made the web so popular.