Searching for file/class names in Netbeans does not work well - netbeans

I started using Netbeans (8.2) a few weeks ago and the search utility is driving me insane. Basically, I search for a class/file name in the top-right corner and it returns with no results, when in fact the class/file exists in the project. The same thing if I do cmd+O (go to type). This does not happen every time, but it happens a lot. Is this a bug? If not, can anyone enlighten me what I'm missing? Thank you in advance.

Yes, I've faced that nasty bug too. It was reported previously (few times) and then closed, but problem remains even in 8.2. It looks like they messed up with index, or cache, or both. I've ended up writing my own search plugin using independent index db. It is called "Quick File Search" and among other features provides button to rebuild it's index (in settings). Also exposing regexp and allow you to automatically add extensions (if you need it).
Disclaimer: yes, I am the author of that plugin.

In my understanding the search box allows you to search everything that you selected (You can change the selection in the icon).
In a simplistic way, the "go to type" refers to files that are related to the code (class files). If you want to go to other type of files you have to choose the "go to file".
So for example if you have a class called Status.java and a file called status.xhtml.
You could get both files with "go to file" (Alt+Shift+O in Linux).
If what you want is only the class then you could use "go to type" (Ctrl+O in Linux)
Before I understood the difference I had some trouble finding files because I only used the go to type which only returned classes.

Netbeans has a limit. If the keyword you are looking for is found 5000 times in some file (mostly say log files), it won't search on other files.
So delete the logs file and you will get to see application files in search results.
Hope that helps.

Related

Eclipse Ctrl+Shift+R not showing all files in the project

When i press Ctrl+Shift+R to open the Open Resource Dialog box, the filter box does not show most of the other resource files for example.. jsp, xml etc. it works fine with all the java files.. This is happening for only this particular java project. i have refreshed the project multiple times but still no-go. I have also rebuilt the index for eclipse under workspace/.metadata/.plugins/org.eclipse.jdt.core by deleting the index files but to no avail.
I am using eclipse Kepler version. Any help would be great..
Thanks All. Yes i had closed and opened the project many times. I have also not set any Resource filter exclusions. What i noticed was that opening any of these files for edit would set off an alert saying file was derived and would i like to edit? But on the properties for these file they were not ticked as derived but rather as Archived. So had to manually hunt for the parent folder which was making these files as derived. Also noticed that the Open Resource Dialog box has option for including Resource files "Show Derived Resources"...
This one helped me solve the problem
Eclipse treating all the files in a project as Derived
This is going to sound ridiculous...but maybe this'll help others too: make sure your file search string is correct! You may need to begin it with a wildcard (*).
I lost about 45 minutes on this as the result of user error.
I was looking for some local files named eRCaGuy_PPM_Writer.h and eRCaGuy_PPM_Writer.cpp (from my repo here). So, I pressed Ctrl + Shift + R and searched for ppm_writer, as shown here:
Nothing! It would not find those files! No matter what I did to the files it couldn't seem to find them. I tried all sorts of things. Then, I realized Eclipse doesn't have a fancy fuzzy search like Sublime Text 3, so I simply added an asterisk (*) to the front of the search, and voila! It works perfectly. Since the "PPM_Writer" part of those two file names is NOT at the beginning, I must start the search with a wildcard (*).
Now it works fine, as you can see here:
I've just added a note about this to my personal Eclipse setup and configuration instructions here: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/tree/master/eclipse (for my full documentation, see also the PDF and Google Drive links at the top of that page).

sublime text - eclipse App Explorer equivalent

Hi I wondering if there is the equivalent to an App Explorer in Sublime Text 2.
When using eclipse, I use the App Explorer panel to search by file name.
I have a file naming convention that helps me find files by there functionality within the system.
So say I want to list all files relating to the registration process. I search for "regis" via the App Explorer and get a nice list of the relevant files. This filtered list is available all the time until I search again.
I can use Sublime Text's cmd+p but prefer the above as I can see the folder hierarchy etc.
In essence it is merely a file name filter on the folder list.
Are there any plugins that may give me something similar.
Any help much appreciated.
No, as far as I can tell nothing like this has been implemented in Sublime Text 2. I would suggest opening an issue at Sublime's UserEcho forum.
In the meantime:
Typing "regis" into Sublime's 'GoTo Anything' panel will bring up the files you're looking for, and show you their paths (I realize this doesn't help you with visualizing the hierarchy, but that's as close as it gets).
I use a package called SyncedSideBar - this will at least show you a visual representation of the folder hierarchy in the sidebar, for the open file, if it's added to the project.
The GoTo Folder package by freewizard may do something similar to what you're looking for, but I had trouble getting it to work. Maybe you'll have more success.
Good luck!

NetBeans: should nbactions.xml, nb-configuration.xml and catalog.xml go into source control?

This thread is very useful for finding out which files in Netbeans should go into source countrol, but it doesn't cover all files.
In particular I'm wondering whether the following files should go into source control. Here are my assumptions/guesses:
nb-configuration.xml - easiest - the file itself in the comment says it should go into source control.
nbactions.xml - from what I see this file stores information typical to running the application. I.e. JVM arguments etc. So I suppose it is a question of taste - if you want other developers to have a "suggested" Run configuration - include it. Otherwise - don't. Correct?
catalog.xml - not sure what this does (I GUESS it's used by the editor to find out xml schemas and such to enable syntax coloring, but it's just a guess). Anyway - I see that this file has system-specific information (path) - so it shouldn't go into source control.
Can anyone confirm the above?
Thanks,
Piotr
I never put my IDE configuration files in the repository, for several reasons:
other colleagues may want to use theirs;
other colleagues may want to use other IDEs (such as Eclipse) and seeing those files (or even have to exclude them from the checkout) could be annoying for them;
some of these files are generally not related to a single project, others automatically generated, so no need to store them in the source code of every project.
In order to exclude them, our first solution was the .svnignore, but it was still logically wrong to modify some shared content for the specific needs of a single user, so we decided to be more strict:
in my ~/.subversion/config I have:
[miscellany]
global-ignores = nbactions.xml nbproject
Hope this helps,
Marcello
In my Maven based projects I put nbactions.xml into source control. Just make sure to change absolute paths to relative ones.
I put nbactions.xml into source control BUT there is a caveat: it's internal format can change so if your developers, for any reason, use different versions of NetBeans you could have to remove it because sharing it becomes nasty.
Recently I upgraded from NetBeans 7.3.1 to 7.4 and the "Run" action was giving a strange error message. I solved the problem by deleting and regenerating nbactions.xml: the old one had a custom Maven goal for the "Run" and "Debug" actions; it was org.codehaus.mevenide:netbeans-deploy-plugin:1.2.4:deploy it was not visible in the IDE v7.3.1 (perhaps it has been generated by an even older version for internal usage) and was generating a class not found for org.openide.util.Lookup in v7.4. I'm documenting the problem here because I found the solution by myself after an unsuccessful search on the Net. I hope this can help someone else.

How to search all open files in Eclipse?

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?
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.
CTRL+E on Windows or Linux, and Command+E on OSX.
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.
This may come too late for the original poster, but just in case somebody else needs to find out an answer, I had the same problem and found my solution by installing a plug-in named Instasearch. You can get it by going to Help/Eclipse Marketplace and searching for Instasearch.
You can find more about this plug-in in the following address.
http://marketplace.eclipse.org/content/instasearch
Spring produces a stand-alone Eclipse plugin (no dependencies on Spring) called Quick Search
http://marketplace.eclipse.org/content/quick-search-eclipse
For efficiency, it searches your open files first. So while it isn't purely restricting to opened files as you requested, you can still get a similar effect in practice by just clicking the first results that come up.
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.
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.)

Eclipse: Refreshing known types in Java project

If you press Shift+Ctrl+T or choose "Navigate > Open Type..." you get the "Open Type" dialog for quickly navigating to a known class. When you start typing a name only the classes for which the name matches stay visible. That way you can find a class of which you know the name very quick without having to browse through the package explorer tree.
This has been working great for me up until this morning. All of a sudden for a couple of my projects I am only seeing some of the types that exist. Of course I tried the obvious steps of refreshing the projects, cleaning the projects, re-building the projects, rebuilding the projects externally, but all to no avail. It is a bit odd since the types are known in other places. If I add an import statement Eclipse does not complain that it doesn't know the type and I can Ctrl-Click through the types to get to their file. However, the type navigation knows nothing about them.
In the past when InteliJ used to do this to me I would go find its cache files and delete them forcing it to rebuild. Does Eclipse have something similar I might do (I'm an Eclipse newbie)? I am using Eclipse 3.4.2 and I have it configured to not delete files on a clean (because our actual build process puts files into the output directories that I don't want Eclipse mucking with).
Have you tried closing and reopening the project? Only types from open projects are held in memory, and the refresh occurs when you Shift+Ctrl+T for the first time on a newly opened project.
Edit to add: Ctrl+Shift+R also displays the types (along with everything else) but it also supports the Camel-case thing to find the Java types quickly.
Close eclipse and delete any .index files and the savedIndexNames.txt file in workspace/.metadata/.plugins/org.eclipse.jdt.core once eclipse is restarted it will rebuildl the entire index for Ctrl+T
try starting eclipse with the -clean flag, you can add this to your eclipse.ini which can be found in the same directory as you eclispe.exe, or if you start eclipse using a bat or shell script, add it as a startup argument, e.g. eclipse -clean.
The clean will tidy your workspace, and should force eclipse JDT to recalulate types. Ive had issue with .snap files (with seem to be created on dirty shutdowns) that seem to corrupt my workspace until I clean them up, not long ago eclipse lost the Object class!! made for some interesting errors!
I get problems like this often. I tried your solution, noticed it seemed to rebuild its search index, but I still couldn't find any of my classes. Then I took a look at the little green arrow on top right corner of that dialog, and noticed I had a working set selected which belonged to another project. I find it a little dumb that Eclipse doesn't warn you about this or anything, since this can be a very annoying little detail that one tends to forget (me at least ;-)).
Anyways, clicked on "Deselect Working Set" and bam I can find my classes again. Thought I'd add this here since others may make the same mistake.
This worked for me -
Select your project in Package Explorer
Press F5 or Right click and select Refresh
I used the "-clean" as first line in the eclipse.ini (version Juno) and worked like a charm.
I'v tried all the answers and I still had the issue. I then tried this:
I deleted the project (it's a maven project) and re-imported it. This time I made sure i check the "Add Project(s) to working set" checkbox. After that Eclipse was able to find the classes in that project.
The problem must have started because I didn't check this checkbox when i first imported this project.
By the way, I'm using Neon
(Warning: Shameless marketing ahead)
If you like this feature, you would love nWire. nWire allows, among other things, to quickly search not only for types, but for any possible Java element like method or field. It also uses a navigator view which is non-modal. After searching you can see the class associations in a very quick and easy way. Check out the video on our site.