Eclipse Project Explorer Filters

Wondering why the Eclipse Project view might not show all files in the Project Explorer view? For example it shows this:

Eclipse Project Explorer View

Eclipse Project Explorer View

But on disk I have more files? Where are they?

💡 I’m using Eclipse Luna (4.4) in this post, but things are very similar for earlier versions of Eclipse.

File System has more Files?

Checking the files on my file system (e.g. with the Windows Explorer), I have more files/folders listed:

Files on the File System

Files on the File System

Obviously, files and folders starting with a dot (‘.’) are not shown in the Project Explorer view.

Project View Filters

The reason is that the Eclipse Project Explorer view has a filter built-in to hide files. There is a setting for this in the View Menu of that view:

Project Explorer View Menu

Project Explorer View Menu

There is a ‘Customize View…‘ menu item:

Customize Project Explorer View

Customize Project Explorer View

And here I have the filters:

Customize Project Explorer View

Customize Project Explorer View

Now it should be clear why the files starting with a dot are ont shown: they are filtered out with the filter for “.*”:

Project Explorer View Filters

Project Explorer View Filters

Un-checking that filter will show now as well the dot files:

Showing Dot Files in Project Explorer View

Showing Dot Files in Project Explorer View

Defining my own Filters

The list of filters in the project view is provided by the plugins. And unfortunately there is no way to define my own filters in the above dialog, unless I would implement my Java plugin. Defining my own filters without programming things is possible, it is just in a different place :-).

For example I do not want to see that ‘ProjectInfo.xml’. For this, I select the project and use the ‘Properties’ menu. Inside the project properties, there is Resource > Resource Filters:

Resource Filters

Resource Filters

Use the Add button to add a new filter:

Adding Filter

Adding Filter

To exclude just the ProjectInfo.xml:

  1. Exclude all (this will exclude all files matching my filter)
  2. Applies to Files (I only want to have it applied to files)
  3. [Name] [matches] the file name
Excluding Files

Excluding Files

With that, I can build any kind of filters.

Pressing OK, and it gets added to my filter list:

Added Filter

Added Filter

Now the ProjectInfo.xml is not listed any more in the Project Explorer view:

Filtered ProjectView.xml

Filtered ProjectView.xml

Summary

The Eclipse Project Explorer view has a setting to turn on/off filters for files/folders, or in general to configure the view. I can use project resource filters to define my own filters too.

Happy Filtering 🙂

2 thoughts on “Eclipse Project Explorer Filters

  1. i just tried the second method in spring tools 4. the filter worked for about 1 second and then the hidden files reappeared. my intellij colleagues laugh at me over things like this

    Like

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.