ColdFusion Builder 2 Extensions - Understanding Callback Commands

Author: sandeepp  |  Category: ColdFusion Builder, Coldfusion, Extensions, General  |  Comments (0)  |  Add Comment

CallBack commands in ColdFusion Builder 2 Extensions make it possible to

1) Get data other than the context in which extension menu was clicked

2) Get additional data/info. required to generate code/any other task while in execution of handler CFM

What are Callback Commands?

Callback commands allows handler CFMs in extensions to communicate back to ColdFusion Builder and execute supported Commands. This communication is done using an HTTP call to a specific Callback URL(specified in ideeventinfo xml). Most importantly this communication takes place while handler CFMs are still in execution. This means using callback commands handler CFMs can

1) Request more information for ColdFusion Builder - Using get commands

2) Request File Operations - Using file commands

3) Get user Input - creating SWT dialog through well formed XML

Following is the List of Supported Commands

  • Get Servers (getservers)
  • Get Datasources (getdatasources)
  • Get Tables (gettables)
  • Get Table (gettable)
  • Get Function and Variables(getfunctionsandvariables)
  • Open File (openfile) - supports placing cursor at a given line number
  • Insert text into Editor (inserttext) - supports to overwrite/wrap selection with insertion text
  • Search file (searchfile)
  • Refresh File, Folder, Project(refreshfile, refreshfolder, refreshproject)
  • Also extensions can create input dialog - by sending xml in similar way as to create dialog through XML response from CFM handlers

What is Callback URL?

Callback URL is the URL used to send your callback commands from CFMs back to ColdFusion Builder. With every ideeventinfo param sent from ColdFusion Builder to handlers, a callback URL is sent, packed inside <ide> tag. Extensions can use this URL to send callback commands to ColdFusion Builder. Syntax for creating Callback Commands is same as Commands in ColdFusion Builder 1 Extensions.

Steps to Use Callback Commands

  • Get callback URL from ideeventinfo XML

  • Create XML to send command to ColdFusion Builder

  • Execute callback command and get response

I have created a simple Demo extension to show how callback commands work. Demo extension includes example for most of the commands used as callback command.

How to contribute to code assist from Extensions

Author: sandeepp  |  Category: ColdFusion Builder, Coldfusion, Extensions, General  |  Comments (0)  |  Add Comment

One of new feature in ColdFusion Builder 2 is the ability to contribute to code assist using extensions. This means that code assist proposals can be contributed using CFML. This allows users to create extensions which provide editor support for given framework or for any other code assist usage.

What contributing to code assist means?

It allows ColdFusion Builder extensions to add their own proposals in code assist popup dialog. Contributed proposals are shown in code assist dialog after regular proposals available through ColdFusion Builder.

How Do I add code assist contribution?

Extensions can specify that they want to contribute to Code assist by specifying this in ide_config.xml inside”<codeassistcontribution>”tag.

eg.

<codeassistcontribution>

<functions>

<!— contributions for functions—>

<functions>

<variables>

<!— contributions for variables—>

<variables>

</codeasistcontribution>

What use-cases are supported for code assist contribution?

a. Contribute code assist proposals for a given function parameters. So suppose if there is a function named “foo” which can take three arguments, I can add code asssit proposals for function foo()’s argument 1 or argument 2 or argument 3 or for all of them.

This means if user invokes content assist for code shown below at given cursor position he will see code assist contributions for arguments 1 ,2 and 3 coming from extension

<cfset foo(|) > , <cfset foo(“arg1”, |)>, <cfset foo(“arg1”, “arg2”, |)>

Code Assist Contribution for Function Arguments

Code Assist Contribution for Function Arguments

Sample code for ide_config.xml:

<codeassistcontribution>

<functions>

<function name=”foo handlerId=”">

<parameter index=”1 />

<parameter index=”2 />

<parameter index=”3 />

</function>

</functions>

</codeassistcontribution>

b. Contribute code assist proposals for a given function invoked on a specific variable. This is similar to previous one with one basic difference. Let’s assume if there is a variable say ”event” available through some framework. And one can invoke function foo() on it. You can now contribute to code assist proposals for this function foo()’s arguments only when it is invoked on “event” variable. So contributed code assist proposals will only be shown for following cases-

<cfset event.foo(|) >, <cfset event.foo(“arg1”, |)>, <cfset event.foo(“arg1”, “arg2”, |)>

Sample code for ide_config.xml:

<codeassistcontribution>

<functions>

<function name=”foo” variablename=”event” handlerId=”">

<parameter index=”1 />

<parameter index=”2 />

<parameter index=”3 />

</function>

</functions>

</codeassistcontribution>

c. Contribute code assist proposals for a specific variable. It can be used to add code assist support for scoped framework variables. This allows to display functions and member variables available on a given variable. So again taking back example of “event” variable, let’s assume that functions foo1(), foo2() and variables “var1” and “var2” are available on it. So now extensions can show these available options on this variable by contributing to code assist. These will be displayed when users presses “.” on event variable on invokes content assist in following case

<cfset event.| >

Code Assist Contribution for Variable

Sample code for ide_config.xml:

<codeassistcontribution>

<variables>

<variable variablename=”event” handlerId=”">

</variable>

</variables>

</codeassistcontribution>

How it works?

Once content assist is invoked on specified function arguments or variable, handler identified with handlerid is called with details about code assist invocation.

These details include

· Function or variable name on which code assist was invoked.

· Index of argument in case of function

· CFC path in case code assist is invoked on variable which is a CFC instance.

Demo Extension

You can download sample demo extension form here to see code assist contribution working.

Just install the given extension, and then you should see code assist contributions from extension in following cases if you invoke code assist at position marked by ’|’  -

<cfset foo1(|)> <!— code assist for function foo1() –>
<cfset event.foo2(|1,|)> <!— code assist for function foo2() on variable event –>
<cfset event.|> <!— code assist for event variable member functions, scope variables etc. –>

How to enforce coding guide lines using CFML Code Formatter

Author: sandeepp  |  Category: ColdFusion Builder, Coldfusion, General, Preferences  |  Comments (0)  |  Add Comment

It’s common when working in a team to have specific coding standards or coding style. What’s difficult is to adhere to these coding standards and to enforce these within a team. CFML code formatter in ColdFusion Builder 2 is just the right tool to help you do this. Using the highly customizable code formatter preferences and export/Import functionality, you can easily create rules for specific coding style and share them across team.

CFML Code formatter – a small intro

CFML Code formatter supports formatting of CFML code along with support to format mixed code within CFML (code with html, java script and CSS in a CFML file). Also Code formatter can be customized to suit your coding style. It comes with lots of options to control how code gets formatted. If you are not aware of how to customize Code formatter, you can do this by navigating to Windows->Preferences->ColdFusion->profile->editor->Formatter page.

Code Formatter Preference Page

Creating New Formatting Profile

Customized Code Formatter preferences are saved in profiles. Formatting profile is nothing more than a set of rules. Code formatter formats code based on these rules. This allows you to easily save different coding styles as profiles. Creating a new profile is easy. Click on Add button on Code formatter preference page to open up Formatting preference dialog. Make changes as per your requirement and save these as new profile. While making changes to preferences you can see the effect of your changes in preview section.

Code Formatter Preference Dialog

Code Formatter Preference Dialog

How Do I share the profile I created?

Once you have created your own formatting profile you can export is to xml files using export functionality on Code formatter preference page.

You can share this exported profile within your team. Using the import functionality others can import this formatting profile and use it to format code. This makes it possible for everyone to use same code formatter preferences and adhere to accepted coding style.

ColdFusion Builder Start page

Author: sandeepp  |  Category: ColdFusion Builder, General  |  Comment (1)  |  Add Comment

Getting started with ColdFusion Builder

ColdFusion Builder 2 Beta is out; you are either new or looking to know more about the newest features, and some HOW-TO information. With the new getting started experience, I’m sure you will spend more time exploring within ColdFusion Builder rather than searching on the web.

Getting Started Page, the first thing displayed after you launch ColdFusion Builder, is a one stop location for most of the things you want to know about ColdFusion Builder 2. So if you have checked the option not to display Getting Started page again, you will really be missing out no lots of great resources to learn and use ColdFusion Builder. Yes, the Getting Started page can help you beyond getting started.

I opted to not display Getting Started page

Not a problem; you can also launch Getting Started page from the Help menu (Help > Adobe ColdFusion Builder Start page).

And now, how does it help?

Not just now, even later, the page can help you as the Getting Started Page has a lot of content dynamically loaded, when you are connected to the internet.

Here is a snapshot of what the Getting Started Experience is:

- Getting Started Videos: Currently you have three video walks you through

1) Project and server setup

2) Debugger setup

3) Editor Enhancements in ColdFusion Builder 2

- Online resources: Apart from the videos, there are links to a multitude of articles and online videos. Links provided under Videos (in the “Other Resources” section) point to online video content around ColdFusion Builder 2 and ColdFusion 9 features such as ORM and caching.

- Extensions: One of the coolest and most loved features in ColdFusion Builder is extensions. Extensions let you add functionality to ColdFusion Builder using CFML. Check out this section to try out extensions built by the vibrant ColdFusion community. Installing Extensions from the Getting Started page is just a one click task.

- Tips: Under Video section, you will see link to advanced tips. This is the best place to learn some tips and tricks around ColdFusion Builder and to discover those small useful functionalities which one would otherwise miss. Random, one tip is displayed and you can check all the tips by clicking Show All button. Also note that these tips get regularly updated. So you will keep on seeing more and more useful tips.

- News Feeds: Keep yourself updated with happenings in the ColdFusion world. Find links to Must read Blogs, learn about latest updates, surveys etc. around ColdFusion from here.

- Recent files: This is a very handy; get quick access to files you have been editing, without searching them in projects.

ColdFusion Builder 2 Now in Public Beta

Author: sandeepp  |  Category: ColdFusion Builder, Coldfusion, General  |  Comments (0)  |  Add Comment

Public Beta of ColdFusion Builder 2 is now available for download on Adobe Labs.

Its full exciting features like Code Formatter, Advance Search and lots of cool editor and extension enhancements.

Read more about what’s new in ColdFusion Builder 2 here.

Try it Now!!!.

Using Filters to control your menu contributions

Author: sandeepp  |  Category: ColdFusion Builder, Extensions, General  |  Comments (0)  |  Add Comment

ColdFusion Builder Extensions allow you to add filters to menu contributions . With this you can control what menus are visible/hidden when the context menu is displayed.

Filter’s can be used for menu contributions to navigator and outline view.

Adding Filters to Menus:

For Navigator you may want to use filter to control menu contributions appearing when user tight clicks a project|folder|file or a file with given name or extension.

For ex. following menu will appear only when user right clicks a project

<menu name="Deploy">
<filters>
<filter type="project" />
<filters>
</menu>

and following menu will appear only when user right clicks a file with name “modelGlue.xml”

<menu name="Validate Config File">
<filters>
<filter type="file" pattern="modelGlue.xml" />
<filters>
</menu>

For outline view you can control for which nodes menu contribution can appear.

For Ex. Following menu will only appear when user clicks on node named “Events” in outline view.

<menu name="Add Event">
<filters>
<filter type="Events" />
</filters>
</menu>

Adding filters for Menu Actions:

Sometimes you may want to show the Menu every time, but may want to hide/show menu actions based on what user has clicked on. This can be achieved by adding filters at action level and not at menu level. So menu will appear all time but, display of individual menu items will be controlled by filters applied on menu action. Here’s an example

<menu name="ModelGlue Assistant">
<action name="Add Controller" handlerid="handler1" >
<filters>
<filter type="controllers" /> <!-- action appears only when user right clicks controllers node -->
</filters>
</action>
<action name="Add Message Listener" handlerid="handler2" >
<filters>
<filter type="controller" /> <!-- action appears only when user right clicks controller node -->
</filters>
</action>
<action name="Remove" handlerid="eventhandler" /> <!-- action appears for all nodes -->
</menu>

Here are the Screen shots for above code-

Above images show the working Action Filters. Here Menu and remove action appear at all places but other actions are controlled by filters.

Adobe ColdFusion Builder - File encoding support

Author: sandeepp  |  Category: ColdFusion Builder, Preferences  |  Comments (0)  |  Add Comment

Adobe ColdFusion Builder by default treats CFML file content as UTF-8 encoded. So when you look at properties of cfm file and it will show encoding as default UTF-8 (determined by content).

This post tells you how to configure Adobe ColdFusion builder to support different file encoding. This is useful when you have CFML files which have encoding other than UTF-8.

So here are the steps -

1) Navigate to preferences->General->Content types page

2) On this page expand Text node and select CFML source file.

3) Once selected, default encoding text field will show “UTF-8″ as default encoding for CFML content.

4) Change this to any desired encoding type and click update button next to this field.

5) Click OK.

6) Reopen file in editor.

Following is screen shot of how to change this preference setting-

Encoding preference

Now file properties will show files encoding as set by user, and file content will be shown properly in editor based on set encoding.

Some useful Keyboard shortcuts

Author: sandeepp  |  Category: ColdFusion Builder, Preferences  |  Comment (1)  |  Add Comment

Here are few useful editor shortcuts when using ColdFusion Builder

  • Toggle between source and preview tabs
              Press Ctrl+Page Down to navigate to next tab
               (eg. from source to preview)
              Press Ctrl+Page up to navigate to previous tab
              (eg. from preview to source)
  • To navigate between all open documents in editor
             Press Ctrl+F6. Keep Keys pressed and select any open file with
             arrow keys or using mouse.
            Or alternatively Press Ctrl+E to get drop down list of open files
            to select from. If this list is too big, you can just type first
            few letters of file name and the list will get filtered automatically.
  • To quick select any currently open View
           Press Ctrl + F7. Keep keys pressed and select available views through
           arrow keys or using mouse.
  • Quick Outline view
           Press Ctrl+O to get quick outline view for cuttently open document.

At any time you want to change these default keys, you can do this via Preferences->General->Keys preference page.

ColdFusion Builder Extensions Tutorial - Part 2 - Adding context menus

Author: sandeepp  |  Category: ColdFusion Builder, Extensions  |  Comments (0)  |  Add Comment

This post from me comes a little delayed than i would have liked, but all I can say is that some cool stuff for ColdFusion Builder has been keeping me busy ;).

So to get started I will cover how to add custom context menu to different views in ColdFusion Builder in this post. Supported views include

1) Project Navigator

2) Outline view

3) RDS Data View

One good way to learn how to add custom menu is to try this out on currently available extensions. For this post I will assume you have already installed Adobe CFC generator.
All you need to do is modify ide_config.xml file (Once you install an extension, config file is placed in install location/<extension name> folder.)

Once you locate ide_config.xml at extension install location, open ide_config.xml file for editing.
Now add following entry directly under <menu name=”Adobe CFC Generator”>

<action name=”hello” handlerid=”helloworld” showResponse=”yes” />

Save the file.

Navigate to Preferences->ColdFusion->Extensions page. Click on Reload Extensions button. This will make ColdFusion Builder reload the currently modified config file and reflect you current changes.

Now when you right click any table on RDS data view, this newly menu will appear under Adobe CFC generator menu.

Once you add menu you want to be able to do stuff when users clicks on it.
to achieve this, again open ide_config.xml and add following entry inside “<handlers>” node.

<handler id=”helloworld” type=”CFM” filename=”helloworld.cfm” />

Now create “helloworld.cfm” file under handlers directory, with content <cfoutput>Hello World</cfoutput>.

Reload extensions again, and this time once you click newly added menu, a dialog will come up showing response from helloworld.cfm.

That’s it you have successfully add custom menu in ColdFusion Builder and handled click event on it.

ColdFusion Builder - HTML Colorization

Author: sandeepp  |  Category: ColdFusion Builder, Colorization  |  Comments (5)  |  Add Comment

In ColdFusion Builder HTML colors can be customized through Preferences->HTML-Editors->HTML->Colors preference page.

HTML colorization affects all HTML tags in a generic way and to set color for individual tags (like Table or Form tags) is not possible.

Here is colorization file to change HTML colors similar to that of Dreamweaver. Since all Dreamweaver colorization option are not exactly mapped to HTML colorization, it tries to match Dreamweaver html colorization as much as possible.

To use this navigate to HTML color preferences and click import button. Point ColdFusion Builder to this .col file and hit apply. That’s it!!

Understanding Default colorization for HTML Tags:

By default angular Braces for HTML tags are colorized differently than tag name. Apart from these most options are straight forward, and should be easy to change through HTML Color Preferences.

Here is how you customize colorization for angular braces around html tags.

1) Select HTML->Editors->HTML->Colors in preferences
2) Expand “Punctuator” node, Select Start Tag.
3) With Start Tag entry selected expand region colorization section below.
4) Change two entries “Tag_part” and “Name_part” to color of your choice.
5) Click apply to notice changes in any currently open file with html code.

Follow similar steps for “Punctuator” End tag entry to colorize html end tag.

Understanding  region colorization:

Regions are used to further break down any known token into number of parts. For eg.  for start tag (”<table>”) you can define 3 different regions as “<” , “table” “>” and colorize them differently.
Any tag with defined region for them have a small bar in front of their entry in token section.
Attached is screen shot which shows start tag with region colorization defined for it.
Also notice small bar in front of start tag to indicate the same.