views:

466

answers:

5

Simple question: how do I search all the files currently open in Eclipse? Note: I don't wanna search all the files I have in that workspace, just the ones open in tabs. Is there an easy way to do this?

+2  A: 

Closest way is selecting several resources in Navigator or Package Explorer view, then press Ctrl+H and choose 'Selected Resources' radio button. It will limit search only to selected files.

Boris Pavlović
+1  A: 

There's no way to do that at the moment.

The easiest solution would be to select your files manually (holding CTRL + click on file) and to specify "selected resources" as your search scope.

dasilvj
+2  A: 

The currently opened files simply aren't considered special in eclipse - you have far more advanced methods of organizing your files: projects and working sets.

Working sets allow you to define sets of files, which can be used as constraints for many operations. You have to define them explicitly, but then they don't change just because you've closed a file.

Michael Borgwardt
Thanks, Michael. I hear your point about the incredible functionality available in Eclipse, but this is one of those instances where simplicity of use should trump functionality. I agree that Eclipse has far more advanced capabilities built in than what I'm asking for, but that's precisely my point. It's so much simpler to implement a "Find in Open Files" than it is to implement the Working Sets concept. I guess for the time being, it'll have to do. Thanks again.
daveslab
But simplicity of implementation shouldn't be a criteria for inclusion. I think the use case for find-in-open-files is too weak to warrant inclusion, although the UI impact would be rather small.
JesperE
A: 

There is no find-in-open-files command in Eclipse, no.

I think that the main reason find-in-open-files is not implemented in Eclipse is probably because the set of open files is for many users rather insignificant. (In fact, I don't know (or care) which files I have open. (I even have Eclipse set to automatically close editors/files when they become too many). If I want to navigate to a file, I open it. Limiting a search to the files I currently have open would be completely pointless for me.)

JesperE
A: 

I confirm this would be a very useful feature. I have been using PhpED for years but recently decided to give Eclipse PDT a chance. However, I am sorely missing something as basic as searching the opened files. I have thousands of files in the workspace (a huge Drupal multisite), but of course most of the time I need to search only the module I am working on.

In PhpED I simply hit Ctrl+S, then Ctrl+TAB to switch from page search to search within opened files, then type my keyword and hit enter. But in Eclipse, even in the newest version (Helios), the best option is grabbing mouse, clicking all the folders in the explorer (because Eclipse does not remember what was opened before last closing!), then finally finding my module's folder, right-clicking on it, selecting "Search" from the menu, then again using the mouse switching to "File Search" tab, then select by mouse "Selected resources", then type my keyword and only then finally hit the enter key. This process is so much slower (esp. because of the necessity of using mouse rather than keyboard shortcuts).

Vacilando