In Eclipse IDE, you can type CTRL + SHIFT + T in Windows or *nix or Command + SHIFT + T in Mac OSX to prompt an Open Type dialog box to find details about a specified Java class.
The default classpath is in the current directory. Usually you put Java classes in packages in a hierarchical directory structure in the filesystem, in which case the Java compiler will also put . class files in a corresponding structure.
One option is to filter derived resources. In the upper right corner of the 'Open Resource' dialog there is an arrow you can click to bring up a dropdown menu for filtering. Uncheck the 'Show Derived Resources' option, if it is checked.
If you still see '.class' files, they probably aren't being marked as derived. If they're by themselves in their own folder hierarchy you can fix this by right-clicking the root folder to edit folder properties, and check the 'Derived' checkbox. If they're mixed with your '.java' files...tough luck, you'll need to set the derived property on each '.class' file by hand.
As far as I can tell there's no way to mark class files as derived resources globally for the workspace, but I believe when you create a new Java project the 'bin' folder is marked as derived by default (if you use the default wizard settings)
Here are some screenshots from Eclipse Kepler. The first shows how to filter derived resources by unchecking 'Show Derived Resources' in the Open Resource dialog. The second shows how to set the 'Derived' property on a resource.
*.class
To exclude an entire directory hierarchy, e.g. the target
directory, select the Files and folders radio button and the All children (recursive) checkbox.
Edit
Exclude the following for a complete cleanup of Open Resource
dialog
Without excluding all 4 it does not work.
To change this behaviour and hide the “.class” files you need to do the following.
Find your class output folder in the “Project explorer” window. This is usually called bin or target for Maven projects
Right-click this folder and click Properties
Tick the Derived checkbox (leave it UNCHECKED) and click OK
.class files will now be hidden in future.
Source: http://ayubmalik.co.uk/2011/12/hide-class-files-when-opening-a-type-or-resource-in-eclipse-ide/
You can use Working sets
. From the same dropdown menu on Open Resource dialog select Select working set
. It opens up the working set dialogue where you can create working sets if you don't already have them.
When creating a new one, choose the type Resources
and select which folders in your workspace are consider as candidates for searching or for opening resources. I have included only src
and test
folders and usually pom.xml
's and other misc configuration files.
With the couple of large projects I'm working on it has a noticeable impact on search speed too.
To solve this globally (on all projects), after pressing ctrl + shift + r, click on the top right corner of the window on the three dots button, then click on Select Working Set, tick both Java Main Source and Java Test Source and voila.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With