One of the most exciting enhancements in ColdFusion 9 is actually not a ColdFusion 9 feature. Rather, it's the introduction of a dedicated ColdFusion IDE—ColdFusion Builder. This new Eclipse-based development environment has been built from the ground up with ColdFusion development in mind, and this article will help you get started quickly and easily.
Introducing ColdFusion Builder
ColdFusion Builder is a ColdFusion IDE built in Eclipse, the same platform which powers Flash Builder (previously Flex Builder). There are some important reasons for this:
- ColdFusion Builder and Flash Builder are designed to work together, and can greatly simplify the development of Flash and Flex applications powered by ColdFusion.
- Eclipse is already popular with ColdFusion developers, thanks to community projects like CFEclipse.
- Eclipse is a proven platform with extensive support for all sorts of development, and all Eclipse plug-ins can be used with ColdFusion Builder. So, if you need something that we did not provide, a third-party plug-in may do the trick.
- Eclipse is supported on multiple platforms, including all of the platforms supported by ColdFusion itself.
ColdFusion Builder can be installed in two ways (using the same installer):
- If you are unfamiliar with Eclipse, and are not already running an Eclipse installation (including Flex Builder and Flash Builder), then the ColdFusion Builder installer can install a complete Eclipse configuration for you, all ready to use.
- If you do have an existing Eclipse installation (including Flex Builder and Flash Builder), then the ColdFusion Builder installer can add ColdFusion support to that existing Eclipse. This is the preferred configuration, particularly if you are using Flash Builder.
ColdFusion Builder is an IDE. It is not ColdFusion itself. To use ColdFusion Builder you'll need access to a ColdFusion server (ideally ColdFusion 9). ColdFusion Builder can work with local or remote ColdFusion servers, but it is highly recommended that you use a local development server (ColdFusion Developer's Edition is free, so no real downside, and lots of upside). You'll also need to know the ColdFusion Administrator and RDS login information for some ColdFusion Builder functionality to work properly.
Getting started with ColdFusion Builder
When you first start up ColdFusion Builder, you may see a splash screen (well, one of several) which you can close. You'll then be presented with the IDE itself. Depending on what Eclipse plug-ins are installed, you may or may not be in "ColdFusion mode". Let me explain.
As noted above, Eclispe can be used for all sorts of development: Java, HTML, CSS, MXML, PHP, and much more. As each type of development needs different screens and panels in an IDE, Eclipse supports the defining sets of configurations called "Perspectives". A perspective is a specific screen setup, with windows and panels and toolbars all configured in a specific way. Switching perspectives is easy, and Eclipse can even auto-switch perspectives for you as you switch between projects and file types.
The Eclipse title bar should show you the perspective in use. In addition, there are buttons on the top right of the screen for switching between perspectives. If the title bar says "ColdFusion", and if you see tabs at the bottom for Servers, TailView, and more, and if you see RDS tabs in the panel on the right, then you are in the ColdFusion perspective. If not, open the Window menu, and choose Open Perspective > Other > ColdFusion. Perspective selections are saved automatically in your Eclipse workspace, and so the next time you open ColdFusion Builder, the right perspective should be open and ready to use.
Defining ColdFusion server connections
Before you can do anything useful with ColdFusion Builder, you need to tell it about the ColdFusion Server you'll be connecting to. You do this in the Servers tab at the bottom of the IDE. Here are the steps:
Click the Add Server button (the one with a server and a yellow + sign).
- Select ColdFusion as the server type.
- Enter a unique server name. This need not be the actual server name. It's what shows up in the server list so you know which server you are referring to. If you are using a local server you may want to just set it to "localhost".
- Enter the Host Name. This is the IP address or DNS name of your ColdFusion server, and it'll be "localhost" for a local development server.
- Enter the Webserver Port. This is usually 8500 for development servers using the integrated HTTP server, or 80 for servers connected to external HTTP servers.
- Enter the Connect Root and Application Server Name only if using ColdFusion deployed on a J2EE server.
- Enter the RDS User Name and RDS Password. If you did not specify an RDS username then the default will be "admin".
- Click Next.
- Specify the Server Home (not the web root). This is the folder into which ColdFusion itself is installed. On Windows machines using a local development server, this may be c:\ColdFusion9.
- Enter the Document Root. This is the web root. On Windows machines using a local development server, this may be c:\ColdFusion9\wwwroot.
- Click Finish.
You'll now have a server listed in the Servers tab. You can click the server to stop it, start it, access its Administrator, and more. These options are available via a toolbar and via right-click menu options.
Creating your first ColdFusion Builder project
Now that you have a server defined, the next step is to create a Project so that you may start development. Here are the steps:
- Choose File > New > ColdFusion Project (or right-click in the Navigator panel on the left and choose New > ColdFusion Project).
- Enter a unique Project Name (project names can have spaces in them).
- By default, Eclipse stores projects in a workspace folder, and these are typically not under the web root. For ColdFusion development, especially when working with a local development server, this is not optimal. So, uncheck the Use Default Location, and enter the path for your project in the Project Location field. The folder should be under the ColdFusion web root, and you may need to actually create a new folder.
- Click Next.
- You'll then be asked for the server to use with this project. Select the server you just defined in the Servers drop down list box.
- Click Next.
- Click Finish.
You now have a ColdFusion project ready to use. You can open and close projects in the Navigator panel (obviously, a project must be open to be able to use it).
Writing your first ColdFusion Builder application
Let's create a quick application to make sure everything is working. Here are the steps:
- Open the new ColdFusion Project, if it is not already open.
- Make sure the project is selected (clicked on, otherwise you may create the file in another project).
- Create a new ColdFusion page by choosing File > New > CFM Page (or right-click in the Navigator panel on your project and choose New > CFM Page).
- Enter a page Name, perhaps "index" (the .cfm extension is optional, and will be added automatically).
- Click Finish.
- The page will now be open for editing. Enter some CFML code, perhaps the following:
Hello, it is #DateFormat(Now())#
- Save the page.
- Below the editor window you'll see browser tabs (the exact list of browsers present will vary based on your OS and the browsers installed). Click any browser to run your code, and you'll see the generated output.
Assuming you made it this far, congratulations! You are now using ColdFusion Builder.
A quick tour of some important ColdFusion Builder features
We've packed lots of features into ColdFusion Builder, but here are some you should be aware of:
- As you type code in the editor, notice that your code is automatically colored. If you are typing a tag and hit space and pause briefly, you'll be presented with a pop-up of available attributes or values.
- The editor also features lots of built-in intelligence. For example, if you are typing datasource="" you'll be presented with a list of available datasources, and when you type query="" in a <cfoutput> you'll be presented with a list of queries already defined. You'll discover lots of other shortcuts like this as you work.
- On the left edge of the editor, you'll see a - sign next to each tag. You can click this to collapse and expand blocks of code.
- Above the editor window you'll see a CFML toolbar. Mouse over each button to see what they do. The leftmost button serves two purposes—if a tag is selected it'll display the attributes for that tag, and if not it'll display a wizard to help you find the tag you want.
- In the panel below the editor you'll see a tab named TailView. This useful tab can show you changes in server log files as they occur. By default no log files will be listed, but at a minimum you'll want to add application.log, server.log, and exception.log (you can add others, too). To add these click the Add Log button (it has a picture of a document with a plus in a green circle) and select the log files to add. ColdFusion log files are in a folder named "logs" under the ColdFusion root.
- The panel on the right of the editor contains the RDS Dataview tab. Use this to browse datasources, run data wizards, and more.
- The same panel contains the Outline tab which shows you the outline of your code and lets you easily jump to specific code blocks by clicking tags.
- All panels can be moved, as can panel tabs (which can be moved from panel to panel. For example, I find that the Services Browser tab a better fit for the panel on the right than the panel at the bottom).
- ColdFusion Builder includes an FTP plug-in that you can use to deploy projects via FTP.
- Earlier I mentioned ColdFusion Builder extensions. These are distributed as ZIP files that can easily be installed into ColdFusion Builder (visit www.riaforge.org to access a growing list of extensions, including Ray Camden's invaluable QueryParam Scanner). To install extensions simply download the ZIP file, then open the Window menu and choose Preferences > ColdFusion > Extensions, click Install, and then follow the prompts.
Where to go from here
We've only touched the ColdFusion Builder surface here, but as you can see, this new tool can already simplify your ColdFusion development, and we're just getting started. ColdFusion Builder can be used with earlier versions of ColdFusion, but it is ideally used with ColdFusion 9. To learn more about ColdFusion 9, read my article Introducing Adobe ColdFusion 9.