Posted in | Posted on 03-09-2010 | 4,242 views
Heres an interesting ColdFusion Builder feature you may not be aware of. CFBuilder does a good job providing code assistance for CFCs. So for example, consider the following code snippet:
2<cfoutput>#ob.
As soon as I hit the dot, CFBuilder introspected my test component and provided the following visual feedback:

CFBuilder is even smart enough to notice private methods. When I changed my drinkBeer to a private method (which sounds kinda sad), it didn't show up in the drop down. However, most of the time we don't work with CFCs like that. Instead we create them on application start up and store them in the Application scope. Wouldn't it be nice if you could get the same code assistance after typing the application scope version of the CFC? The good news is that you can.
In order to use this feature, you need to go into your project properties. Once you've loaded the project pane, select: "ColdFusion Variable Mappings":

For my test, I'm working within the BlogCFC project. I'm going to create a mapping between application.blog and the CFC:

Once I've done that I can then get code assistance on my application variable:

Pretty nifty, eh? As you can guess, setting up these mappings will be a manual process. However, in most projects I'd assume you have a core set of CFCs that act as services. While you may have a large number of components in play, the "core" ones you use will probably be a smaller number. A few minutes of set up and your good to go. One little nit - be sure not to typo. For some reason Adobe included the ability to add and delete mappings, but not to edit them.


It would be nice if we could add Meta Data Tag just about the definition of the variable to help CF Builder do the Variable Mapping.
example:
<cfscript>
// [CFCPath="com.hemtalreja.test.MyObject"]
myObject = Application.beanFactory.getBean("myObject");
</cfscript>
I've generated one for myself, to be save I had closed my cfbuilder before, at startup he will read the new file and works fine.
My builder seems to just randomly lock up and have to be killed from the task manager at least once per day. Has anyone else experienced this issue?
I've tried to make this work, but it never has... I get no code assist at all. I'm guessing I'm doing something wrong, but it just doesn't work for me.
Can you describe how your project is built/structured? For me, I am using a virtual host, which is pointing a few directories under the main root of localhost.
http://darrentcook.wordpress.com/2010/05/05/coldfu...
[Add Comment] [Subscribe to Comments]