The Dopefly Tech Blog

« The Dopefly Tech Blog Main page

Trouble finding things in Eclipse?

posted under category: CFEclipse on August 11, 2008 by Nathan

I've heard it 2 times in the last week that people are having trouble using the find features in Eclipse, so I thought I might be able to help a little.

#1 - Refresh your project files automatically
#2 - The search dialog box

Eclipse search dialog
Hit the link to read it.


#1 - Refresh your project files automatically
Eclipse caches and indexes your code, and when you search, it does not always go back to disk to re-index them. If Eclipse detects that some files are out of date and have not been refreshed, it will just skip them while searching. The solution is to either set up automatic file refreshing or refresh manually. Manually refreshing your files means selecting the part you want to refresh on the Navigator view and pressing the F5 key. You select the root of what exactly you want to refresh, so to refresh a project, select the project root and hit F5. This is not the dreamweaver site refresh thing that makes your IDE crawl while it indexes. It politely runs it in the background in ways you won't even notice it. Do yourself a favor and turn it on:

Open the preferences superdialog - Window > Preferences
Navigate to General > Workspace
Check the "Refresh automatically" checkbox
Hit OK

If you open a project that was closed (right click, open / close project options), these projects are typically out of date, so whenever I open a project, I manually refresh the files first thing.


#2 - The search dialog box
Pressing CTRL + H or navigating to Search > Search brings up the extended search dialog. In Eclipse 3.4, there is a Customize button on the bottom that will allow you to toggle on and off search types that you do or don't want to use. I turn off everything but the "File Search" tab. Seriously, this is the one you need.

The File Name Patterns text field is what files you are searching in. You can put it at "*" to search everything, but I have it at "*.cfc, *.cfm, *.css, *.html, *.js, *.xml" which is all of the relevant files in my project. This field has a limited memory from search to search but sometimes erases entries, so don't trust it.

The Scope area is important.
If you select "Workspace," you will search all of your projects, which may take a while.
If you selected one or more projects, folders or files in the Navigator view, you can search "Selected resources" - this is what I do 99% of the time.
If you have an open file selected instead of items in the navigator, you can search "Enclosing Projects", meaning projects of the files that you have open.
If you have a working set, you can select it here to search, but be careful that the working set contains all the files you are interested in, sometimes they will not see new files.

You can search just for files by name if you leave the "Containing text" area empty.

If you install Aptana, you can use a multiline search. Yep, just like old HomeSite or Dreamweaver.

If that doesn't do it for you, I don't know what will. Anyone care to comment on what other problems they may be having with searching from Eclipse? I've got to say, it works so good for me that I'm shocked when I hear people are having trouble.

Nathan is a software developer at The Boeing Company in Charleston, SC. He is essentially a big programming nerd. Really, you could say that makes him a nerd among nerds. Aside from making software for the web, he plays with tech toys and likes to think about programming's big picture while speaking at conferences and generally impressing people with massive nerdiness and straight-faced sarcastic humor. Nathan got his programming start writing batch files in DOS. It should go without saying, but these thought and opinions have nothing to do with Boeing in any way.
This blog is also available as an RSS 2.0 feed. Click your heels together and click here to contact Nathan.