score:250

Accepted answer

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.

enter image description here

enter image description here

score:0

Showing or hiding files in the Project Explorer view You can choose to hide system files or generated class files in one of the navigation views. (System files are those that have only a file extension but no file name, for example .classpath.)

On the toolbar for the Project Explorer, click the Menu button Menu button to open the drop-down menu of display options. Select Customize View..,.

In the dialog box that opens, select the Filters tab and then select the checkboxes for the types of files that you want to hide. In addition, you can restrict the displayed files to a working set.

enter image description here On the toolbar for the Project Explorer, click the Menu button Menu button to open the drop-down menu of display options. Choose Select Working Set... Select an existing working set from the list or create a new one by selecting NEw check here

score:1

Version 3.5 Open Resource dialog has a way turn "Show Derived Resources" on/off by a small dropdown menu at the top right hand corner. Turning it off will hide classes.

Or

you could type an expression on the "Select an item to open" text box such as : *.java


score:2

Some time you are not able mark build or bin folder as Derived resource, because eclipse package explorer or project explorer does not show you build or bin folder in project view.

What you need to do, to show build folder in project view:

  1. Go to Project > Properties > Java Build Path > Source > change default output folder to build1 Note: It will ask you to remove old folder and its content, Press No (to restore it later)

  2. Now build folder is visible on package explorer, go to folder properties and mark it as Derived

  3. Now change your default output folder back to build (to restore old setting)

score:3

Eclipse Luna - just go to the following link http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-48b.htm
OR
1. Create a working set (include all projects)
2. On "Package Explorer" panel click on "Filters" (in the same menu you just created the working set) and deselect "Inner class files" + click ok

That worked for me

score:7

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.

score:15

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.

score:37

To change this behaviour and hide the “.class” files you need to do the following.

  1. Find your class output folder in the “Project explorer” window. This is usually called bin or target for Maven projects

  2. Right-click this folder and click Properties

  3. 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/

score:148

  1. Right click on the project and select Properties enter image description here
  2. Expand Resource and click on Resource Filters
  3. Click on Add Filter... to create a new filter enter image description here
  4. On the dialog box that opens
    1. Select the Exclude all and Files radio buttons
    2. Under File and Folder Attributes enter *.class
  5. Click OK

enter image description here

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

  1. Files *.class
  2. Folder bin
  3. Folder build
  4. Folder target

Without excluding all 4 it does not work.


Related Query

More Query from same tag