2017年10月2日 星期一

Is there a “Find in Files” shortcut in Eclipse? [memo@slackoverflow]


https://stackoverflow.com/questions/7569630/is-there-a-find-in-files-shortcut-in-eclipse


8 Answers

select workspace and press Ctrl-H
Which dialog is selected, depends on which file type is selected in the Project Explorer view. For example, if you selected a .js file and press Ctrl-H, it will bring up the dialog with the "Javascript Search" tab selected. If you want to search all files, you can press Ctrl-F7 to select the Project Explorer view, use arrow keys to select a folder above your files, then press Ctrl-H(or select a file, whose type doesn't trigger a custom dialog tab).
shareimprove this answer
   
Thank you. It's called "Open Search Dialog" for what it's worth. In Visual Studio it's called "Find in Files". They appear to be the same functionality. – Xonatron Sep 27 '11 at 13:11
   
However, you have to split the search by only one of the following: Type, Method, Package, Constructor, Field... I just want to search everything. Is there a way to do this? – Xonatron Sep 27 '11 at 13:13
4 
@MatthewDoucette When you have the dialog open click the left arrow in the top right of the box and you should be able to find the "File Search" tab. That should be what you're looking for. – Shaded Sep 27 '11 at 13:22
3 
Selecting the "File Search" tab will give you what you seek. Eclipse has special searches for different languages. Funny, the Java Search you are describing is one feature I miss dearly in visual studio :). – AheSep 27 '11 at 13:22
   
Added more to my answer. Salazaar's answer is also correct. Just depends how you want to do it. – Gordon Glas Sep 27 '11 at 13:25
up vote26down voteaccepted
Thanks to the other two solutions, but here is the complete answer I was looking for, which addresses how I search all the text within the files, not just types, methods, packages, constructors, and fields:
  • Ctrl+H to open the "Search" dialog box
  • "File Search" tab, if it does not appear, expand the window or use the left/right arrows
  • type in the text to search for
  • Use "*.java", in my case since I am coding in Java, to search just these files
  • Click "Search"
shareimprove this answer
   
You can actually get "File Search" to be the default when Ctrl + H is clicked by setting it in the key binding. (goto Windows>Preferences and search for keys and filter by 'file search'. And type Ctrl+H in the Binding section) – Joseph Rajeev Motha Oct 28 '15 at 0:40
If you are using only the File Search, you can Disable all other Searches in the Search Panel (Customize... lower left Corner). Then you have the File Search everytime you Press Ctrl+H
shareimprove this answer
   
Great! Now how do I search all the text within the files, not just types, methods, packages, constructors, and fields? – Xonatron Sep 27 '11 at 13:49
   
I have found the solution, and will edit my original post with it. – Xonatron Sep 27 '11 at 13:56
3 
you can also re-bind Ctrl+H to "File Search" instead of "Open Search Dialog". To be honest, I've never found a use for any of the other search tools. Re-binding is an alternative to this element of the solution, but but with the benefit of leaving the other tabs around. Either this option or re-binding would save you the second step above of finding the "File Search" tab. – Matt Felzani Jan 9 '12 at 20:31
   
really awesome answer, i was looking so far! – Emmanuel Angelo.R Nov 5 '14 at 7:03
If you want to use the type-specific search (Java, Javascript ...etc) you can use Ctrl+H, which opens the search dialog, then click the Search button.
If you simply want to search for all text occurrences in the whole the workspace click the word (or select the text) you want to search then hit Ctrl+Alt+G. You will directly get all the found occurrences without even using a dialog box.
I find Ctrl+Alt+G is the best solution because it shows the variable name in different by related files (e.g. Java and XML, or Javascript and HTML) while still having the type-specific search feature available through Ctrl+H
You can rebind the Ctrl+Alt+G to finding text in a project or a working set instead of the whole workspace if that's more appealing to you.
shareimprove this answer
  • Ctrl+H to bring up the search box
  • Click 'Customize' in the lower left
  • Checkmark 'Remember last used page'
  • Click OK.
  • Select the file search tab and do a search
shareimprove this answer
   
I hope this reaches the top someday. Simple, best answer. – Noumenon Sep 16 '16 at 21:43
Yes, there is shortcuts for searching Eclipse, these shortcuts are very useful when we search for particular html, jsp , xml, java, properties ,class, jar,search file with keywords.
  • Ctrl+H is used open Tag, in that you can select type of file Remote Search, File search, git search, java search, javascript search , etc
  • Ctrl+Shift+R is used to search all files in the current project
  • Ctrl+Shift+T is used to search all files in the workspace
shareimprove this answer
I believe adding plug-ins power your needs.
If you install Plug-in named InstaSearch it makes your searching faster inside current active working projects.
It shows the result as you type.
shareimprove this answer

press Ctrl + H . Then choose "File Search" tab.
additional search options
search for resources press Ctrl + Shift + R
search for Java types press Ctrl + Shift + T
shareimprove this answer

0 意見:

張貼留言