Contact Us Today!   |   + 1 (301) 424 3903



CFEclipse 1.3 Update - Part II

Hello World,

In my last post I talked about two of the several new features of the CFEclipse 1.3 update. One of which was the Code Snippets feature. Although the Code Snippets has been a feature of CFEclipse for some time now most people (including myself) are either unaware of its existance or its features. I would like to revisit the Code Snippets in this post. I admit that I did not give Code Snippets the credit that it deserved. After playing around with the Code Snippets panel for more than 15 minutes I found that it has a bit more to it than one might think at first glance. So let's look a little beyond the first glance and explore a couple of the coolest features of the Code Snippets panel.

1) User Variables: One of the coolest features I found while using the Code Snippets was the use of variables in your snippets. You can define variables within your code snippet. Your variables can be defined as shown below:

$${yourvariablename}

Here is an example of how you would use the variable definition:

<cfquery name="$${queryname}" datasource="cfdocexamples">
</cfquery>

Now when you double click on your Code Snippet in order to place it into your code, a dialog box will be displayed prompting you for a value for the queryname variable. You can define more than one variable within your code snippet. See below:

<cfquery name="$${queryname}"
datasource="cfdocexamples"
cachedwithin="#CreateTimeSpan($${days}, $${hours}, $${minutes}, $${seconds})#">

</cfquery>

Using this code snippet, the dialog box will prompt you for the queryname, days, hours, minutes, and seconds.

2) System Snippet Variables: In addition to being able to use your own variables you can also use the following System Snippet Variables:

$${DATE}      - Enters the date as MM/DD/YYYY E.g. 11/30/2007
$${MONTH}      - Enters the month as text E.g. February
$${TIME}      - Enters the time E.g.: 7:29:58 AM
$${DATETIME}      - Enters the date and time E.g.: 2/9/2007 7:29:58 AM
$${DAYOFWEEK}      - E.g.: Friday
$${CURRENTFILE}      - Current file name (just the file)
$${CURRENTFOLDER}   - Current folder (The path to the containing folder)
$${CURRENTPATH}      - Current path (full file name)
$${CURRENTPRJPATH}   - Just the folder
$${USERNAME}      - Current user
$${MONTHNUMBER}      - Month as a number
$${DAYOFMONTH}      - Day of month as a number
$${DAYOFWEEKNUMBER}   - Day of week (the week starts on Sunday)
$${DATETIME24}      - DateTime24 - a 24 hour clock version of datetime.
$${YEAR}      - Current year.
$${YEAR2DIGIT}      - Current two digit year.

Here is an example of you might use one of the System Variables:

<!---
   <fusedoc
      fuse="$${CURRENTFILE}"
      language="ColdFusion">

      <responsibilities>
         $${response}
      </responsibilities>

      <properties>
         <property
            name="Date"
            value="$${DATE}">
      </properties>
   </fusedoc>
--->

As you can see this is a sample fusedoc that uses a couple of the System variables to automatically substitute the current file and the current date. A user variable is defined which will prompt for the responsibilities text.

CFEclipse TV

The CFEclipse.org site has added a new section called CFEclipse TV. This section hosts several screencasts describing some of the features of CFEclipse including Using Snippets for Speedy Coding and Getting Started.

<⁄post>

Related Blog Entries

Comments
Oğuz Demirkapı's Gravatar Theo, thanks for these great notes!
# Posted By Oğuz Demirkapı | 2/19/07 11:48 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner