I work for Adobe Systems and I have been part of ColdFusion Engineering Team for almost 5 years now. Off late I have been involved in delevlopment of ColdFusion Builder, and I also had my share of work on the ColdFusion Server. sandeep is a DZone MVB and is not an employee of DZone and has posted 4 posts at DZone. View Full User Profile

ColdFusion Builder 2 Extensions - Understanding Callback Commands

  • submit to reddit

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.

Published at DZone with permission of sandeep , author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)