Getting Started with Adobe ColdFusion Builder

  • submit to reddit

Getting Started with Adobe ColdFusion Builder

By Terry Ryan

5,162 Downloads · Refcard 90 of 200 (see them all)

Download
FREE PDF


The Essential ColdFusion Builder Cheat Sheet

ColdFusion Builder is Adobe's new IDE designed to deliver truly rapid application development using its ColdFusion server product. It’s the first IDE dedicated specifically to ColdFusion, and is based on Eclipse. Therefore, it works easily with Adobe Flash Builder and other Eclipse plugins. This DZone Refcard will assist you in the installation process amd get you started with the basics of ColdFusion. It will also help you to start your first ColdFusion project, and review the many interesting features that come with this IDE.
HTML Preview
Getting Started with Adobe ColdFusion Builder&trade

Getting Started with Adobe ColdFusion Builder™

By Terry Ryan

INTRODUCING ADOBE COLDFUSION BUILDER

ColdFusion Builder is Adobe's new IDE designed to deliver truly rapid application development using its ColdFusion server product. It is the first IDE dedicated specifically to ColdFusion since Macromedia turned out its last release of ColdFusion Studio back in 2001. ColdFusion Builder is based on Eclipse, and not the previous tool. Therefore it works easily with Adobe® Flash® Builder™ and other Eclipse plugins.

INSTALLING

ColdFusion Builder is an Eclipse plugin, and like Flash Builder can be installed in one of two methods: standalone and plugin. Which one you chose will depend on whether you are already using Eclipse and whether it makes sense for you to include ColdFusion Builder in your workflow.

Standalone

Standalone creates a packaged version of ColdFusion Builder, which includes Eclipse. It will be labeled “ColdFusion Builder” and have icons and splash screens that reflect this. However, most of these differences are cosmetic only. It's still Eclipse, and this version of it is fully capable, so you can use other Eclipse plugins in this install.

Plugin

The plugin version requires you to have Eclipse already setup on your machine. It installs itself as a plugin into that copy. So all of your screens will still say Eclipse, and ColdFusion will just be another perspective. This can be any version of Eclipse you have pulled down from eclipse.org, or a packaged Eclipse install like Flash Builder.

STARTING A NEW PROJECT

The basic collection of code in ColdFusion Builder is a project. Many developers setup one ColdFusion Builder project per ColdFusion application. However, they are not required to a one to one match. Some people make the root of their project the root of their Web server, and have all of the applications under one giant project. This Refcard will show how to do a 1 app to 1 project match.

Opening up a new installed version of Coldfusion Builder should show you something similar to figure 1.

To create a new project:

  • Create a folder in your ColdFusion's webroot named SampleProject
  • Go to the File Menu -> New -> ColdFusion Project
  • Give your project a name: SampleProject
  • Uncheck the Use Default Location check box
  • Hit the Browse button and navigate to your ColdFusion webroot
  • Create a new folder named SampleProject
  • Make sure it is selected and click Choose
  • Click Finish

New ColdFusion Project dialog

To start experimenting with ColdFusion Builder we will need a ColdFusion file, called a “template”.

To create a new ColdFusion template:

  • Go to the File Menu -> New -> ColdFusion Page
  • If Location is blank, click the Browse button
  • Select Sample Project
  • Click Ok
  • Set Name to index.cfm

We could also use a ColdFusion Component to show some things off.

To create a new ColdFusion Component:

  • Go to the File Menu -> New -> ColdFusion Component
  • If Location is blank, click the Browse button
  • Select Sample Project
  • Click Ok
  • Set the Component Name to utility
  • Check the box labeled Generate Script Style Code
  • Click Finish
  • Add the function listed below to utility.cfc between the two curly brackets:

Public string function getToday(){
	return dateformat(now());
}

You now have files to test. You can experiment with these if you like. To get the full use out of ColdFusion Builder we need to configure it to communicate directly with our ColdFusion server.

CONNECTING TO SERVERS

ColdFusion Builder wants to know about the servers that you develop on. By having that information it can allow you to manage the servers through the IDE, get extra logging information and browse datasources and file systems on the server. It also allows ColdFusion Builder to provide "code insight" which means that the IDE knows about the components, methods and variables that you are currently working with.

It's recommended that you do your development against a locally installed version of ColdFusion on the same workstation as ColdFusion Builder. We're going to assume you have a default install of ColdFusion running the ColdFusion Web Server. If you are using your own Web server like Apache or IIS your settings may vary.

To configure a local server:

  • Find the Servers tab in the bottom of the IDE window
  • In the top of that click the New Server icon (a server tower with a plus sign over it)
  • Set the following values:
    • Name: localhost
    • Host Name: localhost
    • Select Is Local from the radio box
    • WebServer Port: 8500
    • Skip down to Other Setting
    • Put in your RDS username and password
  • Click the Next button to move on and set the next set of values:
    • Server Home:
      • On OSX : /Applications/ColdFusion9
      • On Windows: C:\ColdFusion9
    • Document Root:
      • On OSX : /Applications/ColdFusion9/wwroot
      • On Windows: C:\ColdFusion9\wwwroot
  • Click the Finish Button

ColdFusion Builder now knows about your server. We just need to tell “SampleProject” to use that server.

Configure Project to use Server:

  • In the left hand Navigator window Right Click SampleProject
  • Choose Properties
  • Select ColdFusion Server Settings
  • Select Localhost from the list

To see if this is working we need to preview index.cfm

Preview Web page:

    If not open, open index.cfm Type hello world in the editor window Choose File -> Save to save the file Locate the Source tab at the bottom of the editor Next to Source you should see tabs labeled “Safari”, “IE”,“Firefox” depending on what you have installed. Choose the browser of your choice “Hello World” should appear in bold.

INTRODUCTION TO VIEWS

ColdFusion Builder's tooling is divided into several forms called views.

Navigator

The Navigator is a basic view that comes with Eclipse. It allows you to see and organize your projects and files.

One of the overlooked featured of this view is the concept of “Working Sets”. They allow you to group various projects together and then selectively show or hide groups. This is very effective when you have tens of projects split amongst many clients. This can allow you to only see your current projects without having to go through the trouble of archiving and removing projects that you aren't working on but could pick up at any moment.

To access Working Sets:

  • In the Navigator Panel
  • Click the down arrow at the top right
  • A menu should open with Select Working Set

File

The File view allows you to navigate the file system of your workstation independent of any projects you may have setup. This is useful if you need to quickly open a file from a project before you started using ColdFusion Builder and Projects. One of the other things the file view can do is connect to FTP/ SFTP servers. This means that you can review remote files, and edit code on them.

Servers

We used the Server view previously to add a server. However it can do more. Through this interface you can do the following:

  • See current status
  • Start/Stop/Restart Server
  • Launch the Administrator
  • Launch the Server Monitor

Servers tab

Console

When you start your ColdFusion server via the Servers view, the Console output for the server is printed here. This can be very useful for seeing errors occur in real time. Also content that is written to the main application log for your server will show up here. So you can use CFLog to make content appear in the Console.

Tail View

Tail View allows you to see the contents of a file updated in real time. This is very useful for targeting the error log of your ColdFusion server. However it's important to note that you are not limited to ColdFusion logs. Any text file on your system can be seen this way, like your Web server logs, or mail logs.

Service Browser

The Service Browser shows you all CFCs that are installed under a ColdFusion server's webroot. It allows you to inspect all of the methods, see arguments, and filter for access.

It also allows you to paste code calling these CFCs and methods into your code window.

To paste code from Service Browser:

  • Open index.cfm
  • Click the Service Browser tab
  • Right Click the icon for localhost
  • Click Refresh Active RDS Server
  • Find and Expand SampleProject in the list
  • Expand SampleProject.utility
  • Right Click getToday()
  • Choose Insert CFInvoke
  • Look at index.cfm in editor window; a cfinvoke tag should now be in the code.

Extensions

This view allows you to install, review information about, refresh, and delete ColdFusion Builder Extensions. These will be discussed separately.

Outline

Outline presents organized version of your highlighting major structures in your code. You can use the outline to click through to those structures in your code. It is configurable, sortable and filterable, so you can choose what shows up in the outline.

A great use of this is when you inherit a project where the functions in CFCs aren't alphabetized. You can easily go to the Outline view, filter for functions, and then sort alphabetically.

RDS Views

RDS stands for Remote Development Services in the ColdFusion world. It allows developers to access key pieces of information about a remote server. It has be be setup as part of your ColdFusion server install. Be aware that it is perfectly reasonable to have installed on your local install of ColdFusion, but it is discouraged on public facing or shared hosting machines due to the large amount of information it makes available.

RDS Dataview

RDS Data view allows you to see and interact with datasources that you've setup on your ColdFusion server. It allows you to see tables, views, columns, and column definitions. Using context menus from this view you can activate the RDS Query Viewer.

RDS Dataview

RDS Query Viewer

This view is an interactive query window that allows you to test SQL SELECT statements against your datasources. Note that it only allows SELECT, you can not use it to alter data in the datasource.

RDS Fileview

This allows you to browse the file system on your ColdFusion server. This is obviously much more useful for remote server then for your local system.

Snippets

Snippets allow you to create brief bits of reusable code, organize them, and pull them into your code. You can even create shortcuts that you can use to pull snippets into your source code using shortcut keys.

To Create a Snippet:

  • Go to the Snippet View
  • Click the Plus icon
  • Set the following values:
    • Name: Quick Date
    • Trigger Text: qd
    • Start Block:
      <cfoutput>#DateFormat(Now())#</cfoutput>
    • Click Ok

You should now have a snippet named “Quick Date” in your Snippet View.

Snippets View

To use a Snippet:

  • Open index.cfm
  • Double Click “Quick Date” in the Snippets View
  • Date code should appear

However we can do that even faster. Delete that quick date in index.cfm.

To use Trigger text:

  • In index.cfm type “qd”
  • Now hit CTRL + J
  • Date code should appear

WORKING WITH CODE

The ColdFusion IDE main purpose is to write ColdFusion code. There are a number of features that make the possible

Code Assist

Code Assist refers to ColdFusion Builder knowledge about the CFML and CFScript languages. When you are typing out ColdFusion language constructs, it can prompt you with attributes speeding up your coding.

To see Code Assist in action:

  • Open and delete any code in index.cfm.
  • Type <cfmail
  • Hit Space and wait
  • A drop down list of attributes should appear
  • Type su; the drop down list should only have subject in the list
  • Hit Enter
  • You'll have subject=“” with your cursor between the quotation marks.

Code assist view

In addition to code hinting for CFScript and CFML, ColdFusion Builder can do this for HTML, JS, and CSS.

Code Insight

While code assist is about knowing what the language is capable of, Code Insight is about knowing what the code you are writing is doing. This will allow you to make references to scopes, variables, and components that you have written, and get drop down lists of variables, and methods in those structures.

To see Code Insight in action:

  • Open and delete any code in index.cfm.
  • Type <cfset test = New
  • Hit Space and wait.
  • A drop down list of components should appear
  • Type Sam; the drop down list should now only have SampleProject.utility().
  • Hit Enter
  • You should have <cfset test = New SampleProject.utility()
  • Close it up with >
  • Type <cfset date = te and wait
  • A drop down list with just test should appear
  • Hit Enter
  • test should appear
  • Type . and wait
  • getToday() should appear
  • Close it up with >
  • Type <cfdump var =“#date#”/>
  • Preview the page with the browser tab

Those dropdown lists for both component and methods were the Code Insight feature in action.

Refactoring

Refactoring encompasses a lot of things. In ColdFusion Builder this feature was installed with only one of those things, method renaming. This allows you to rename a method, and have references to that method also be renamed, without having to manually find and replace those references.

To Rename methods:

  • Open index.cfm.
  • If you have just done the Code Insight Example, continue, if not delete the contents of index.cfm, replace and save with this code:

<cfset test = New SampleProject.utility()>
<cfset date = test.getToday()>
<cfdump var =“#date#”/>

  • Now open utility.cfc and highlight function name getToday()
  • Right Click and choose Refactor > Rename
  • For New Name type getCurrentDay
  • Then Click Preview
  • You should see a list of all of the changes that will be made
  • Click Ok

Renaming dialog

USING EXTENSIONS

ColdFusion Extensions allow you to extend ColdFusion Builders features and functionality with ColdFusion. Using some XML to wire ColdFusion Builder views to backend ColdFusion code, you can make the IDE do anything ColdFusion can do.

Installing Extensions

Extensions are packaged as zip files. You manage the install of them through the Extensions view.

To Install an Extension:

  • Click the tab on the Extensions View to see all currently installed extensions
  • You may have some already installed. If you currently have one named “Adobe CFC Generator” installed
  • If you do, highlight it and click the red X icon in the Extensions toolbar to delete
  • Choose Completely uninstall
  • Click the Plus Icon to add an extension
  • Navigate to where you installed ColdFusion Builder
    /Applications/Adobe ColdFusion Builder on OSX
    C:\Program Files\ Adobe\Adobe ColdFusion Builder on Windows
  • Drill into the subfolder extensions
  • Click Adobe CFC Generator.zip and click Open
  • The Extension wizard will open
  • Click Next
  • In Select Server choose localhost
  • Click Finish
  • When you are notified of success, click Ok

Using Extensions

ColdFusion Builder extensions can be used in a variety of ways. They can generate code. They can analyze code. There's even one that will translate content in your editor window from one written language to another, using the Google Translation API. In short they can do anything ColdFusion can do.

The Adobe CFC Generator is a basic code generator.

To use Adobe CFC Generator:

  • Open the RDS Dataview panel
  • Expand localhost
  • Expand cfartgallery
  • Expand Tables
  • Right Click APP.ARTISTS
  • Choose Adobe CFC Generator -> Create CFC
  • Browse to SampleProject
  • Click Ok
  • You should see 4 new files:
    • ARTISTS.cfc
    • ARTISTSDAO.cfc
    • ARTISTSGateway.CFC
    • ARTISTSService.cfc

These files have all of the code to wire up a remote Web service to manipulate the Artists table from a ColdFusion AJAX or Flex front end for your applications.

Finding Extensions

The largest concentration of extensions currently resides at RIAForge.com. By February 2010 there were close to 30 Extensions for ColdFusion Builder, which was in beta. It's expected that many of the major frameworks will release extensions to go along with their tools.

TIPS

Enable Line Numbers

By default, ColdFusion Builder (and Eclipse) does not have line numbering enabled.

To enable line numbering:

  • On OS X go to the Adobe ColdFusion Menu -> Preferences
  • On Windows go to the Window Menu -> Preferences
  • Drill into General -> Editors -> Text Editors
  • Check the “Show line numbers” check box

Change Profile

ColdFusion Builder has a default set of color coding and shortcut keys. If you've migrated to ColdFusion Builder from Dreamweaver or CFEclispe you may not like the current configuration. If so, you can easily change this by alerting your profile.

To alter your profile:

  • On OS X go to the Adobe ColdFusion Menu -> Preferences
  • On Windows go to the Window Menu -> Preferences
  • Drill into ColdFusion -> Editor Profiles
  • Select another “Active Profile”

You can also create your own profiles if you wish.

Change Syntax Highlighting

Any IDE worth its salt is capable of color code. The main feature here is tweaking the color settings.

To change Code Coloring settings:

  • On OS X go to the Adobe ColdFusion Menu -> Preferences
  • On Windows go to the Window Menu -> Preferences
  • Drill into ColdFusion -> Editor Profiles -> Editor -> Colors
  • Tweak colors on Keywords and what not.

However, these settings are not enough for many programmers so you are better off editing the colorization file directly.

To edit Colorization file:

  • On Colors Preferences page
  • Click “Export...”
  • This will export a .col file.
  • Edit this col file
  • Click “Import...”
  • Select the edited .col file.

About The Authors

Photo of author Terry Ryan

Terry Ryan

Terry Ryan is currently an Adobe Platform Evangelist for ColdFusion. His job is to drum up support and excitement among developers for Adobe ColdFusion. He has been working with it for over 10 years. He's presented at various Adobe ColdFusion events including cf.Objective, webDU, and Adobe Max. Prior to joining Adobe, Terry worked for the Wharton School of Business at the University of Pennsylvania in various roles around ColdFusion from Application Developer to System Administrator.

Terrence Ryan | Adobe Platform Evangelist | http://terrenceryan.com

Recommended Book

Adobe Coldfusion Getting Started

This Getting Started volume starts with Web and Internet fundamentals and database concepts and design, and then progresses to topics including creating data-driven pages, building complete applications, implementing security mechanisms, integrating with e-mail, building reusable functions and components, generating datadriven reports and graphs, building Ajax-powered user interfaces, and much more.


Share this Refcard with
your friends & followers...

DZone greatly appreciates your support.


Your download should begin immediately.
If it doesn't, click here.