Skip to main content

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.

Comments

  1. The cfbuilder blog indicates that ColdFusion Search can search "Selected Lines": http://blogs.adobe.com/cfbuilder/2011/03/coldfusion-search-vs-eclipse-search.html
    However, I have not been able to figure out how to do this, can you explain how this is done?

    ReplyDelete
  2. Seth,

    One can select some lines in the editor and invoke ColdFusion search using the shortcut key. The scope would be set as 'Current document'. Now if a search is performed by specifying a search string, it would highlight the matches only in the Selected lines.

    ReplyDelete
  3. @Seth,

    One can select some lines in the editor and invoke ColdFusion search using the shortcut key. The scope would be set as 'Current document'. Now if a search is performed by specifying a search string, it would highlight the matches only in the Selected lines.

    ReplyDelete
  4. Thanks, do you know anyway to restrict the "Replace All" function to just the selected lines?

    ReplyDelete
  5. 'Replace All' is restricted to the selected lines. Are you not able to perform a 'Replace All' operation for selected lines?

    Can you let me know the scenario in which this fails?

    ReplyDelete
  6. Sure, here is a scenario that doesn't work as I would expect...

    http://pastebin.com/Tfh6TFg3

    ReplyDelete
  7. @Seth,

    Can you make sure the file is saved before you select the lines and invoke the ColdFusion search window.

    I was able to reproduce this when the file was not saved. However, it replaces the matches in the selected lines only when the file is saved.

    ReplyDelete
  8. @Sagar
    Yes, I have the same experience. I assume that having to save the file is not intentional behavior.

    On a related note, CF Search does not work when you open a previous file revision via Subclipse. For example, I have a CFM page checked-in to a Subversion reposistory and I right click on the file and go to Team->Show History. I double-click a previous revision and the file opens from the repository. I then click Ctrl-F to search and the dialog appears but does not submit. Clicking the Find button does not do anything, I have to cancel the dialog to continue.

    I brought this issue up in the pre-release forums, but I'm not sure if a bug was filed or not.

    ReplyDelete
  9. @Seth,

    One has to save a file and perform a search operation. The search engine requires the user to save the file. We did come across this issue, however since there is an easy workaround we didn't fix this.

    w.r.t. search in files opened from any version control such as Subversion, is a known bug. Even many of the features including color coding fail.

    ReplyDelete
  10. Are you planning on fixing the find and replace issue? I don't think saving the file is a good workaround. In many cases developers don't want to save until they are finished with their edits - such as what they might be doing with find/replace. Also, saving the file will often trigger project builders and that might not be ideal if editing is unfinished.

    ReplyDelete
  11. We did come across this issue, but thought that the severity of this is lower than the other bugs. Hence we decided not to fix it since there is an easy workaround.

    If you think otherwise, please log a bug and we will evaluate it.

    ReplyDelete
  12. Thanks Sagar, I just voted on the existing bug:
    https://bugbase.adobe.com/index.cfm?event=bug&id=2878816

    ReplyDelete
  13. I am on a 60 day trial of CFBuilder 2.0.0 and I am finding that simple Find/Replace does not work reliably at all with ColdFusion RDS. When dealing with a single file, it lets me Find/Replace all day on .cfm files, but the minute I try and perform a Find/Replace on a different file type (.css, .js, etc.) it does not work at all. In fact, if I click "find all," for a simple textual search the Find/Replace dialogue tells me that there is "no open file" ... any ideas on this?  If I can't get this to work I simply can't use the product.

    ReplyDelete
  14. @69258924f76281c3965fd9d038b0418f When invoking the search make sure the file is open in the Editor. Otherwise the above error message would be thrown. Search for different file type should work, can you restart and then try the search.

    ReplyDelete
  15. This functionality is poorly implemented and a right PitA. Is there any way of disabling it and returning to the normal Eclipse Find/Replace functionality?


    --
    Adam

    ReplyDelete
  16. No. What do you mean when you say 'This functionality is poorly implemented'? In fact CFBuilder allows you to search for text as well as tags.

    ReplyDelete
  17. This:
    https://bugbase.adobe.com/index.cfm?event=bug&id=3103374
    https://bugbase.adobe.com/index.cfm?event=bug&id=3203291
    https://bugbase.adobe.com/index.cfm?event=bug&id=2878814
    (you can probably close two of those as duplicates)

    This:
    https://bugbase.adobe.com/index.cfm?event=bug&id=3213991

    This:
    https://bugbase.adobe.com/index.cfm?event=bug&id=2869755

    This:
    https://bugbase.adobe.com/index.cfm?event=bug&id=2878816

    This:
    https://bugbase.adobe.com/index.cfm?event=bug&id=3133086

    Possibly this:
    https://bugbase.adobe.com/index.cfm?event=bug&id=2864451

    It says it's fixed, but last time I checked it was not. Will verify this evening and update the ticket.

    Nothing major, but a whole host of minor things that just make it a PitA to use, and I'd rather do without whatever bells and whistles it supposedly adds to the experience and just use the standard Eclipse functionality. It's really annoying it cannot be overriden, given the Eclipse functionality IS still there, as it still shows up for non-CF files.

    --
    Adam

    ReplyDelete
  18. CF Search is the only reason why I haven't purchased CFB2. I agree with Adam, the bugs collectively present a poor user experience. The biggest problem I have is that the dialog position is not saved. even when it's already open, it repositions itself in the middle of the editor window. It become so annoying that I went back to CFB 1, and now I've abandoned that and am using Sublime Text 2.

    ReplyDelete
  19. CFB2 Search is similar to the search available in Dreamweaver. I agree that this might not provide good experience to eclipse users. Can you try to unbind the search command from preferences and see if it works (I haven't tried it though).

    ReplyDelete
  20. Hi Sagar.
    It's not because it's different, it's because it's flaky as sh!t. And the standard Eclipse search isn't: it works fine. I'd rather have something with slightly less functionality that *works properly* than something with bells and whistles and... bugs.


    I tried to bind a key to the original Eclipse version, and it didn't work. This to me is yet another bug: CFB's bolt-ons should not interfere with Eclipse's baseline functionality.


    Cheers for the suggestion though: I do appreciate you trying to help!


    --
    Adam

    ReplyDelete

Post a Comment

Popular posts from this blog

Adding beforeRender and afterRender functions to a Backbone View

I was working on a Backbone application that updated the DOM when a response was received from the server. In a Backbone View, the initialize method would perform some operations and then call the render method to update the view. This worked fine, however there was scenario where in I wanted to perform some tasks before and after rendering the view. This can be considered as firing an event before and after the function had completed its execution. I found a very simple way to do this with Underscore's wrap method.

De-obfuscating javascript code in Chrome Developer Tools

I had blogged about JavaScript debugging with Chrome Developer Tools  some time back, wherein I have explained how these developer tools can help in debugging javascript code. Today Google Chrome 12 was released and my Chrome browser was updated to this version. As with every release, there have been some improvements made on performance, usability etc,. One feature that stood out for me is the ability to De-obfuscate the javascript code. What is Minification? Minification is the process of removing unnecessary characters such as white spaces, comments, new lines from the source code. These otherwise would be added to make the code more readable. Minifying the source code helps in reducing the file size and thereby reducing the time taken to download the file. This is the reason why most of the popular javascript libraries such as jQuery are minified. A minified jQuery file is of 31 KB in size where as an uncompressed one is about 229 KB. Unfortunately, debugging minified javascript f

On GraphQL and building an application using React Apollo

When I visualize building an application, I would think of using React and Redux on the front-end which talks to a set of RESTful services built with Node and Hapi (or Express). However, over a period of time, I've realized that this approach does not scale well when you add new features to the front-end. For example, consider a page that displays user information along with courses that a user has enrolled in. At a later point, you decide to add a section that displays popular book titles that one can view and purchase. If every entity is considered as a microservice then to get data from three different microservices would require three http  requests to be sent by the front-end app. The performance of the app would degrade with the increase in the number of http requests. I read about GraphQL and knew that it is an ideal way of building an app and I need not look forward to anything else. The GraphQL layer can be viewed as a facade which sits on top of your RESTful services o