Quantcast
Channel: T. C. Mits 108 » java
Viewing all articles
Browse latest Browse all 36

In Eclipse, search for all text in current file?

$
0
0

Many good editors, especially graphical based ones, allow the user to search the current file for all occurrences of a text string. Some will offer to highlight the text, others will use a search output window to show the search results. Note that this is automatically performed for the currently edited file. This is required to make an unimpeded grasp of a code base, to keep up with the thought process. Opening up dialogs and clicking and clacking breaks the flow.

Eclipse can’t do this!
Yup, its been around so long, and it still can’t do this simple thing. I could be missing something, an obscure magical key binding, a buried preference, but I’ve looked.

Current Options
Lets be more accurate. The Eclipse IDE has powerful search capability and it could find all text within a file and put the results into the search result window. However, invoking this for ONLY the current edit window is a user experience failure. What are the options? Using the default key bindings:

  1. Ctrl-H: brings up a modal dialog window that has a plethora of options, but germane to this blog rant, nothing in the file path input.
  2. Ctrl-F: Another window, which is the above window lite. At least it is targeted for the current file. But, it won’t show all matches; turning off incremental just turns off searching per each keystroke into the text input field.
  3. Alt-F: This one will find all occurrences of text in the current file. Awesome!!! But, only for the currently highlighted text string in the editor. Sheesh, first I have to find it in order to find it. Que “The Three Stooges” theme song.

What To Do?
Enhance Eclipse so that when the user does an Alt-F keystroke, check if text is highlighted in the current edit window. If there is, do the above. It there is no highlighted text, then put up a version of the simple search dialog that Ctrl-F would have created, but this dialog would have a new “All Occurrences” select box already checked. That was easy!

I would even do it myself except, learning the Eclipse internals and all associated devadministrivia would be a career in itself. So in the meantime lets just warm up our fingers in the morning cause they’ll have to be limber; a lot of dialogs will have to open and close just to find what your after.

Related

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Viewing all articles
Browse latest Browse all 36

Trending Articles