Is there a good "find all" function in Eclipse? - eclipse

I have been using Eclipse for R and C++. So far I have not been able to find a reliable "find all" function. It seems to be an easy concept, I search for a string such as "rows" and the function should return all occurences of it within the that I currently have open. (Even if it's in all files in my owrkspace, that's fine too.)
However, I have either not understood how to use the "search" functions correctly or they are very buggy.
So my question is how do I search for all occurences of a string in a file in Eclpise?
Adobe Dreamweaver, for example, has been able to do this for years.(Although it's completely unrelated to R and C++)
I would like to view a list of all occurences and then be able to click on a specific occurence to go to it.

After opening Eclipse, (corresponding to a workspace), Press "CTRL + H" anywhere and you can search anything
like java files that contain specific "keywords".
all occurences within a java file.
plugins names etc

Just type "rows" or whatever the search term is somewhere in text, select it (so that it becomes highlighted) then press "Alt+Ctrl+g". This will perform a global search for that term, pretty handy.

Related

How to get a list of all files matching search criteria in VSCode?

As per the answers in this question, there are two primary ways to search for files in VSCode:
By using CTRL/CMD + P/E to search and "go to file"
By clicking anywhere in the explorer tree and typing
Why do the above solutions not suit my needs?
I need a way to search for files and get a full list of them (in plain view) so I can easily scan them.
The 1st method returns only partial results unless I scroll down.
The 2nd method only searches the folder tree that's currently open.
I know I can use the find command in Linux to achieve this, but can I achieve something similar in the editor itself?

Stop eclipse renaming inside strings

I've been having this problem for some time and have never bothered to fix it since Eclipse has a horrible help system and I can't seem to find the right Google keywords to find what I need.
My problem is that when I refactor a class name, eclipse looks for all potential locations of that name and replaces them.
For instance, if I have a string inside a test case for the "list command" that says something like, "List - list all the users on a team", when I refactor the List.java class to something like UserListCommand.java, the expression inside the string also changes to "UserListCommand - list all the users on a team"
This is SOOO annoying! And like I said, Google is useless when you cannot even think of the right keywords to use.
Has anyone else had this problem and solved it?
Thanks in advance.
Eclipse calls this updating textual occurrences in comments and strings. I sometimes turn this on so javadoc gets updated correctly if I didn't properly link it. But it can be a pain because it sometimes replaces substrings that match.
I've only seen this when renaming classes or interfaces (methods don't seem to do this, at least not for me),
You need to open the Rename Dialog to stop eclipse from updating textual occurrences in comments and strings:
Highlight the type you want to rename, then either:
press Shift+Alt+R
Right click, then go to refactor->rename.. then instead of typing the new name, there should now be a yellow context popup menu under the class name to be changed which says "Enter new name, press Enter to refactor", notice that there is a down arrow to expand the menu. If you press that instead of enter a new name a new drop down menu appears, select Open Rename Dialog...
Once the Rename Dialog is open:
uncheck "update textual occurences in comments and strings (forces preview)" and "Update fully qualified names in non-Java text files (forces preview)"
Hope that helps

Partial AutoComplete in eclipse?

I'm very happy with the way eclipse autocompletes for me, but I was wondering if it could do something more...
I often have very similarly named variables, such as myPlayerManagerPane and myCharacterManagerPane, I was wondering if there was a way that would allow me to get half way into the name, type a character or two and then autocomplete. This would let me copy and past lines of code for both, then surgically edit the variable names. It's gotten to the point where I'm trying to do this (I'm autocompleting on autopilot) and getting fun variables such as myCharacterManagerPaneManagerPane as I autocomplete a whole name, halfway through another.
Is there a way around this?
In Window > Preferences > Java > Editor > Content Assist, select "Completion overwrites", instead of "Completion inserts". This would overwrite the entire variable with the new one.
Alternatively, you can press Ctrl to toggle this behaviour when the content assist window pops up.
Your question (or rather, its prelude) can easily be confused with another one; namely,
Say I have two variables variableLabel and variableConfiguration, how can I have Eclipse complete the common prefix of the two variables, i.e. variable, before writing either L or C and having Eclipse "AutoComplete" complete the rest?
This is the question which lead me to this thread, so I feel I must answer it:
In Window > Preferences > Java > Editor > Content Assist, check "Insert common prefixes automatically". Pressing Ctrl+Space now results in the desired functionality.
Relevant StackOverflow question

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.

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.