Mar 14, 2011

Tag replace - Actions in ColdFusion Builder

Tag search is that one powerful feature in ColdFusion Builder 2.0 which allows you to search for tags that match some criteria. Also, there are various actions that the user can perform once the tag is found. Actions such as
  •  'Replacing the tag block' with some text,
  •  'Removing the Tag block', 
  •  'Setting an attribute', 
  •  'Removing an attribute',
  •  'Adding text before the tag block' and
  •  'Adding text after the tag block'. 
In this post I'll explain how these actions can help you increase your productivity in your day to day application development.

Action - Setting an attribute

Consider a use-case where you would like your ColdFusion application to be available to other web clients such as a HTML client or a FLEX client. In these cases you will have to update the cffunction's access attribute to remote. Updating each and every function definition can be a time consuming task. With the action Set attribute one can specify the attribute that you would like to update with the given value:


As we can see in the above screenshot, a condition 'cffunction tag with attribute access is Any value' is specified (i.e. the tag search engine would search for cffunction tags whose access attribute will be any value). The action selected is Set attribute with attribute access selected with its value set to remote. On clicking 'Replace All', all cffunction tags in the CFC will now have the access attribute set to remote. How easy was that? Gone are the days when you had to go through the entire file and update the tag attributes where ever required.

If you specify an attribute which doesn't exist, then the attribute would be added to the tag definition. Action Set Attribute is used for both adding and updating the tag definitions.

Action - Remove attribute

Action Remove attribute is used to remove an attribute from the tag. So if you would like to remove an attribute, say output attribute of cffunction tag, then select Remove attribute as the action and specify the attribute that you would like to remove:


Actions - Adding text before and after the tag block

While editing a CFC containing various cffunction tags, there are times when you would like to add a generic comment before the function definition, stating its description. Also you would want to add a comment stating the end of the function tag block at the end of the cffunction tag. With the new Tag search, you can specify the tag as cffunction and then add a condition (if required) and click 'Add'. Now in the Action list, select Add before Tag and specify the text that you would like to add. In this case, it would be a comment as shown in the picture below:


Click on Replace All and you will see that the comment is added before the tag block.

Similarly, in case of Adding text after the tag block, select Add after tag and specify the text that you want to add after the function definition:


Again, click 'Replace All' to add the comment at the end of every function definition.

Actions - Replace tag block and Remove tag block


Other actions provided include Replacing a tag block and Removing a tag block. As the name suggests, on selecting the action Replace tag block, the tag block is replaced with the text that the user has provided:


Similarly if you would like to remove the tag block, then select the action Remove tag block:


All the actions mentioned above can be performed in all the scopes. Please refer to my previous post where in I have describe various scopes available for both text and tag search. 

Mar 12, 2011

A cheat sheet of keyboard shortcuts in ColdFusion Builder

In my last post I have explained about keyboard shortcuts in ColdFusion Builder 2.0. This blog post contains a list of all shortcut keys and I have listed these keyboard shortcuts based on the categories that it falls into. Well, this post was not planned since users can easily get to know the keyboard shortcuts by navigating to the preferences (ColdFusion -> Profiles -> Keys). However, I met Joshua at Scotch on the rocks in Edinburgh and he suggested that it would be nice to have the list of keyboard shortcuts handy. So this post is for those who would like to have the list with them and refer it whenever required.


Keyboard shortcuts for inserting text:

These are the keyboard shortcuts which are used to insert some text into the editor:

Command Keyboard shortcuts on Windows Keyboard shortcuts on Mac
Insert anchor tag CTRL + T, L CMD + T, L
Insert bold tag CTRL + T, B CMD + T, B
Insert br tag CTRL + T, R CMD + T, R
Insert cfabort CTRL + T, A CMD + T, A
Insert cfdump CTRL + T, D CMD + T, D
Insert cfscript block CTRL + T, S CMD + T, S
Insert cfset CTRL + T, = CMD + T, =
Insert HTML comment CTRL + T, / CMD + T, /
Insert Italic tag CTRL + T, I CMD + T, I
Insert nbsp tag CTRL + T, N CMD + T, N
Insert p tag CTRL + T, P CMD + T, P
Insert strong tag CTRL + T, K CMD + T, K
Wrap in ## CTRL + T, H CMD + T, H
Wrap in cfoutput CTRL + T, O CMD + T, O
Wrap in try catch CTRL + T, T CMD + T, T
Wrap/Unwrap in CF comment CTRL + T, M CMD + T, M
Wrap/Unwrap in CF script comment CTRL + SHIFT + 8 CMD + SHIFT + 8
Wrap in double quotes CTRL + SHIFT + ' CMD + SHIFT + '
Wrap in single quotes CTRL + ' CMD + '

Keyboard shortcuts for invoking wizards:

There are various wizards in ColdFusion Builder, now you can invoke these wizards using a keyboard shortcut:

Command Keyboard shortcuts on Windows Keyboard shortcuts on Mac
Add CF Server CTRL + ALT + W, A CMD + ALT + W, A
Import CF Project CTRL + ALT + W, I CMD + ALT + W, I
Launch RDS Query Builder CTRL + ALT + W, R CMD + ALT + W, R
New CF Project CTRL + ALT + W, P CMD + ALT + W, P
New CFC CTRL + ALT + W, C CMD + ALT + W, C
New CFI CTRL + ALT + W, W CMD + ALT + W, W
New CFM CTRL + ALT + W, M CMD + ALT + W, M
SQL Editor CTRL + ALT + W, S CMD + ALT + W, S


Keyboard shortcuts for Extensions:

Command Keyboard shortcuts on Windows Keyboard shortcuts on Mac
Import Extension CTRL + SHIFT + E, M CMD + SHIFT + E, M
Install Extension CTRL + SHIFT + E, I CMD + SHIFT + E, I
Reload Extension CTRL + SHIFT + E, R CMD + SHIFT + E, R

Keyboard shortcuts for various Editor features:

Navigation enhancements:

Command Keyboard shortcuts on Windows Keyboard shortcuts on Mac
Go To Next Member CTRL + SHIFT + DOWN CMD + SHIFT + DOWN
Go To Previous Member CTRL + SHIFT + UP CMD + SHIFT + UP
Jump To Next Attribute Value CTRL + ] CMD + ]
Jump To Previous Attribute Value CTRL + [ CMD + [
Jump to Matching tag CTRL + ALT + M CMD + ALT + M

Other Editor features:

Command Keyboard shortcuts on Windows Keyboard shortcuts on Mac
Launch in External Browser CTRL + ALT + E CMD + ALT + E
Lowercase CTRL + SHIFT + L CMD + SHIFT + L
Uppercase CTRL + SHIFT + U CMD + SHIFT + U
Select Tag Block CTRL + ALT + B CMD + ALT + B
Toggle Folding at Selection CTRL + ALT + F CMD + ALT + F
Tag Editor CTRL + SHIFT + T CMD + SHIFT + T

You can also download the pdf containing this list of keyboard shortcuts from http://tinyurl.com/4uztbe2

Mar 11, 2011

Forget the mouse, keyboard shortcuts are here - ColdFusion Builder

ColdFuison Builder 2.0 is all about productivity, it has introduced a lot of keyboard shortcuts, about 42 of them. Shortcuts have been provided for inserting text, invoking wizards, shortcuts for all new editor features and shortcuts for Extensions. Want to define a keyboard shortcut for a piece of code? Possible. Not only that, you can also Export and Import the keyboard shortcuts, so that you need not redo the task of defining a list of keyboard shortcuts on a different installation.

What comes with ColdFusion Builder 2.0?

You get 42 keyboard shortcuts and I know remembering all of these 42 keyboard shortcuts seems to be a daunting task, but the way these keyboard shortcuts have been designed doesn't require you to remember each and every shortcut. The keyboard shortcuts have been grouped into three categories: Insert options, Wizard options and the Extensions options. Each of these categories start with a key combination. For example the Insert options start with CTRL + T and when you press this key a list of keyboard shortcuts will be shown at the bottom right corner of the screen. The same goes with Wizards (CTRL + ALT + W) and Extensions (CTRL + SHIFT + E).

You can refer to all the keyboard shortcuts by navigating to Windows -> Preferences -> ColdFusion -> Profiles -> Keys.


This list also includes some special keyboard shortcuts, these are used to perform some specific editor functionality. For example the shortcut key for 'Jump to the matching tag' is CTRL + ALT + M, 'Code Folding' it is CTRL + ALT + F. It is easy remember these as well; M for 'Matching tag' and 'F' for 'Code Folding'.

Example:
Press CTRL + T and you should get a list of keyboard shortcuts at the bottom right corner of the screen:


As you can see the above list shows all the Insert options and all of them start with the key combination CTRL +T. Now to insert say a cfscript tag, press CTRL + T and then press S. Please note it is not CTRL + T + S, one is required to press CTRL + T and then press S. Also, one need not wait for the popup to come up, just press the associated key and the action would be performed.

It is also possible to change the key binding for any of these keyboard shortcuts. Navigate to the Keyboard shortcut preferences, click on the shortcut key that you want to change and update the key binding in the section below the list.

Define your own keyboard shortcut

To define your own keyboard shortcut navigate to the keyboard shortcut preferences and click on 'Add' button. This would enable the section for defining your shortcut key, enter any name, provide a description (not mandatory) and then provide the key binding. If the provided key binding conflicts with any of the key bindings then the conflict section would be shown listing the shortcut keys with which the key binding conflicts. User will not be able to save the shortcut key until the conflicts are resolved. After providing a valid key binding, provide the text that you would like to insert and then click the 'Save' button. This would save the custom key binding and the same would be shown in the list.

It is also possible to define the cursor position once the text is inserted i.e. while providing the 'Insert text' if one adds the macro $${CP}, the cursor would placed at this position.

For example, if the 'Insert text' is say

$${CP}

and once the text is inserted the cursor would be placed at $${CP}.

Export and Import Keyboard shortcuts

If you have defined several keyboard shortcuts, it would be a big pain to do the same on a different installation. However, with the Export\Import functionality one can export the keyboard shortcut definitions to a csv file and import the same in a different installation.

Mar 9, 2011

Quick Fix in ColdFusion Builder

Quick Fix is another interesting feature introduced in ColdFusion Builder 2.0. The CFML Editor now provides corrections to the problems found in the file that you are editing. The Editor tries to resolve the CFCs specified at various places i.e. in createObject function, the new operator or the ones specified in the tags cfinvoke\cfobject. The Editor also tries to resolve the functions using CFC introspection. Now if you have declared a CFC or a function which doesn't exist, then the CFML Editor instead of showing an error in document provides Quick Fix suggestions.


Quick fix suggestions for components:


As shown in picture above, the CFML Editor was not able to resolve the component 'Component1' and instead of showing an error, the Editor has shown a yellow marker indicating that a quick fix suggestion is available. On clicking the yellow marker, a list containing suggestions are shown.
On selecting the first suggestion, the component will be created in the same directory as the cfm file. The user need not invoke the New CFC wizard. Instead, the IDE will create the component on users' behalf. 
On selecting the second option, the component would be created right under the webroot of the associated server. If the server is not associated with the project, then this suggestion would not be shown.
The third option would create the component in a directory location specified by the user.

Similarly quick fix suggestions would be shown for the tags cfinvoke and cfobject. Quick fix suggestions are also shown if the Editor is not able to resolve the components mentioned as attribute values to extends or implements in a cfcomponent tag.

Quick fix suggestions for functions:

Quick fix suggestions are also provided for functions which are not defined. Taking the above example, once the component is created and when you try to invoke a function which doesn't exist, then the quick fix will suggest you to create a function. 


On accepting the suggestion, the function would be created in Component1. 

If one invokes a function with arguments, then the cffunction with arguments would be created. Say if I invoke a function with two arguments 'arg1' and 'arg2' which are of type numeric and string respectively, then a cffunction would be created with two arguments and the type of those arguments will be numeric and string.   That is, arguments will be of the same type as the parameters passed to the function.
How cool is that... 

If you are writing a script style code, then the component or the function would be created in script style syntax.


Mar 6, 2011

ColdFusion Builder Search\Replace - A new story

ColdFusion Builder 2 (codenamed 'Storm') the next version of ColdFusion Builder is now public beta and it comes packed with several new features. One of the highlights of this release is the ColdFusion specific Search and Replace feature; CFB is an Eclipse based IDE and the search\replace functionality provided in the 1.0 version of the product (codenamed 'Bolt') used the Eclipse's search and replace functionality. Storm now comes with a separate engine for Search and Replace.
One can search not only for text but also tags based on the conditions that you specify. The search scope is now widened and users can search over various scopes such as Open documents, Projects, WorkingsetWorkspace, Local directory, Selected Resources and over any of your FTP\RDS connections. And that's not it, you can also perform certain actions on the matches found. In this post I'll be providing an overview and will try to deliver more complex scenarios in the coming posts.



The Search dialog:


The search dialog shown above looks very compact and is packed with features. The scope combo box lists various scopes across which search can be performed, by default the 'Current Document' will be set as the scope. The search combo box lists two options Text and Tag. There is text box for entering the string that you would like to search and a text box to replace the matching string. Also, as noted from the above screenshot there are various options provided to perform search. However, you get more options when you switch to other scopes or when you switch to Tag search.

Tag search:



When the search scope is changed to Tag search, the ColdFusion search dialog box changes its layout to provide various options which are relevant to the tag you search. After selecting the tag from the list ('Choose Tag'), there are various conditions that the user can select and add to the list.

Conditions:

There are various conditions that you can specify to search for tags. Conditions such as With attribute, Without attribute, Containing (Tag\Text), and Not containing (Tag\Text).

With attribute:


When the condition 'With attribute' is selected the dialog box also provides attribute matching conditions 'is\is not\containing\does not contain\starts with\ends with'. User can provide the attribute name and the value for the same. If no conditions are added to the list then the file would be searched for the mentioned tag.

Without attribute:




When Without attribute is selected an attribute list is shown and this will match all the tags which do not contain the specified attribute.

Containing Tag\Text:




Users can now search tags that contain the specified Tag\Text. An example would be to search for cffunction tags that contain cfargument tags.

Not Containing Tag\Text:




Similar to containing; the Not containing condition would select those tags which do not contain the specified text\tag.

Users can specify multiple conditions for tag search. By specifying Any of the conditions an 'OR' operation would be performed by the tag search engine; meaning that if any of the tags match any of the conditions then it would be returned. Similarly with 'All of the conditions' an 'AND' operation would be performed and only the tags matching all of the conditions would be returned.

Actions:

The Action section lists everything that you can do with the tag searched and found. Apart from Replace\Remove the tag block you can perform various other actions such as Add Text Before\After the tag block and Set\Remove the attribute.
I will be explaining more about Actions in my next blog post.

Mar 3, 2011

What's new in ColdFusion Builder Storm- picture

ColdFusion Builder - Storm is public beta and you can download Storm from labs.adobe.com.
I just completed my session at SOTR and all the new features are on the picture below: