Searching a string in eclipse workspace - eclipse

How to search for a string in the complete eclipse workspace?
I was not able to locate a text in the eclipse workspace however I could not find the specified string in the workspace.

At the top level menus, select 'Search' -> 'File Search' Then near the bottom (in the scope) there is a choice to select the entire workspace.
For your "File search has encountered a problem", you need to refresh the files in your workspace, in the Project/Package Explorer, right click and select "Refresh" at any level (project, folder, file). This will sync your workspace with the underlying file system and prevent the problem.

Press Ctrl + H, should bring up the search that will include options to search via project, directory, etc.
Ctrl + Alt + G can be used to find selected text across a workspace in eclipse.

Ctrl+ H, Select "File Search", indicate the "file name pattern", for example *.xml or *.java. And then select the scope "Workspace"

Eclipse does not search if the "File name patterns" field is empty.
So, if you want to search some text, write within "Containing text" field
and leave by default "File name patterns" with asterisk (*).

A lot of answers only explain how to do the search.
To view the results look for a search tab (normally docked at the bottom of the screen):

eclipse instasearch plugin is a very useful plugin for search needs inside eclipse.
It is based on lucene. This is also available in eclipse marketplace.
It has extensive feature set.
Instantly shows search results
Shows a preview using relevant lines
Periodically updates the index
Matches partial words (e.g. case in CamelCase)
Opens and highlights matches in files
Searches JAR source attachments
Supports filtering by extension/project/working set

For Mac:
Quick Text Search: Shift + Cmd + L
All other search (like File Search, Git Search, Java Search etc): Ctrl + H

Goto Search->File
You will get an window, you can give either simple search text or regx pattern. Once you enter your search keyword click Search and make sure that Scope is Workspace.
You may use this for Replace as well.

Press Ctrl+shift+L and type your string

In your Eclipse editor screen, try Control + Shift + R buttons.

Related

How to find folder in VS Code?

I have a project with a lot of files and folders. There are no problems with finding files. They can be found with Ctrl-P. But there are many folders in which files with the same name are made. Therefore, it is easier to search for a file by the name of the folder in which it is located. How in VS Code to search for folders in the current open project?
For example, I have the following project structure:
A/
main.js
B/
main.js
...
Z/
main.js
The file main.js from the folder P will be easier to find by the folder name.
While using Ctrl-P, you can type the full path of the file, so if i have two files named bar you can search on Ctrl-P with
"foo/bar" or with "qux/bar"
Vscode uses fuzzy search (like so many others), so you don't have to actually type the whole thing.
There is no way, to my knowledge and research, to find and be directed to a specific directory.
You can simply select a folder on the explorer and tape some filter keywords.
Recently, vscode added a shortcut, if you are using a recent release just typing won't work, first tape ctrl + f.
Ctrl + Shift + E
and start typing. You'll see your search on the top right corner of file explorer.
By default it does not filter by result but your focus will jumps to the first one. From there you can Enter to open it.
If you want to show only results containing the string of search : click on filter icon next to your search (state will be remembered).
Echap
to exit/remove search
or
Ctrl + Shift + E
again to switch back focus to last place you were typing.
This VSCode extension does exactly what you're asking for.
https://marketplace.visualstudio.com/items?itemName=rwu823.open-folder
I found a way to search through subfolders. Click on a folder you wish to search, than / and start typing for a name of subfolder
It's simple. Just open the parent folder of your folder in VSCode. Then right-click on the folder you want to find subfolder in and choose "Find in folder"

eclipse multiple text selection like sublime text 2

is there an option or plugin for eclipse which would enable multiple simultaneous selections in the same editor.
In sublime text, selecting some text and then pressing Ctrl+d will add next instance of the same text to the selection if possible. After selecting the instances needed the editor has multiple carrets (not necessarily on the same or adjacent columns and rows). In this mode it is possible to move all cursors forward or back simultaneously and to edit all instances of text simuntaneously.
I find this feature very usefull and miss it sorely in eclipse..
This Eclipse plugin attempts to provide this feature: https://github.com/caspark/eclipse-multicursor. From the README:
What is this?
A work-in-progress attempt to provide Sublime-Text-like
multi cursor support for text editors in the Eclipse IDE.
What works?
Multiple identical lines can be edited simultaneously using Eclipse
linked mode editing (similar to existing "rename in file"
functionality)
Next steps
"select next" functionality + associated editing using Eclipse linked
mode
"find next" + associated editing
editing of non-identical text / editing without using linked mode
split selection to lines
regexp support for find next
This feature is available in LiClipse.
See it in action (more towards the end of the video).
It supports linking with Ctrl+K, unlink with Shift+Alt+K, Ctrl+Alt+mouse double click to select words or Ctrl+Alt+Mouse to make a selection of a region (or just end lines).
Preferences>General>keys>Rename - refactoring
I changed the binding to command + shift + R when > Editing Text.
Sorry for bringing up an old question, stumbled upon it after searching google for the problem
Alt + Shift + A, then you can hold shift and use the cursor in multiple lines.
Like Ctrl+D I could not find, but like Alt+F3 in sublime (multiselects all matches), you can do by pressing Alt+Shift+R, or select text > right click > refactor > rename.
Must say that this does not work with any kind of text. It works with names of variables, functions, classes etc.
Tested on Eclipse 3.8.1
ALT + SHIFT + F worked for me.
You can see shortcuts for all here:
Goto -> Window -> Preferences -> General -> Keys and search for replace then you will see binding for Find and replace. In the bottom of that window, you can add your key to Binding text box. There you can add or edit any keys as shortcut.
If you want to replace selected word's matching words or find selected words, use below keys because you do not need to select all words in eclipse:
Ctrl+F gives me Find/Replace dialog box.
Or you can,
First Alt+A
Next Alt+F
Then press on Replace or Search button occurding to your need.

Best way to search for instances of a string in Eclipse

I am trying to find where a particular variable is being set. Is it possible to search through a set of project source files to find all the possible spots a certain variable might be getting set?
The search in the drop-down menu is a bit confusing to use. After I enter a search I happen to be looking at, and I know it is there, when I do a search from the root of the file system, it tells me that the string is not there :)
Is this a common newbie issue? I just recently started using Eclipse and could just be missing something simple :)
Thanks,
Alex
Select the field where it is declared, then ctrl+shift+H to open the search dialog. The "Java Search" tab should be selected with the Search string populated with your field name, including package. In "Search For" select "Field" and in "Limit To" select "Write accesses" That will show you everywhere that field is assigned.
Here's a screenshot of the search dialog.
I believe the default mapping is Ctrl Shift G.
Highlight the variable and do Ctrl Shift G it will find all references of that variable.
Be careful, it will not just do assignments, so you might be getting more data than you want.

Search in Eclipse through project

How to search in Eclipse through project for some word ? When I start CTRL-h I need to choose field, method or ...., but I need to find all occurences in project no metter method, field or .. ! How to achieve that ?
CTRL + H -> File Search -> Containing Text 'some word'
make sure the scope is set to workspace or enclosing projects. Choosing Selected Resources will narrow the result set to the folder or file you selected in the explorer.
Further if you know the file type that might contain the text you can use the File Name patterns with values like *.php, *.phtml, *.html
Ctrl + Alt + G might help finding Text in the new Version of Eclipse 3.7.
In order to accomplish it you need to customize your research:
Ctrl + H
then at the bottom of the search window click on Customize
check only FileSearch and unselect the rest of the options
then you can search for anywork in the project by selecting either worksapce or Enclosing project
If you are using InstaSearch Eclipse plugin you can easily filter searches by project:
proj:MyProjectName textToFind
or use ui to select a project to search in.

finding a function with particular name

How can i search for a function with particular name in my entire project.I dont even know if the function by that name exists.So i cant find references to that function by right clicking and then selecting the required option.
For example in eclipse we have one short curt ctr + shift +R to search for all classes with particular name.
Ctr + 0 to search for function in current class.I want to search in entire workspace
You can use the Java... option in the Search menu. The default options will search the entire workspace for all references and declarations of the search string. If you want to search only for declarations, there is a Limit To option.
Ctrl + H will give you the full text search of Eclipse.
In the tab Java Search you can specify to search for methods only (Limit to) .
At the bottom you can also specify the scope of your search, in your case that would be 'Workspace'.
If that does not suit your need type Ctrl + Shift + L twice, this opens the menu with the list of all Eclipse hotkeys.
There you can for example sort by category and browse all hotkeys in the search category. That will give you quite a good list of the possible search options you get withing eclipse.