Eclipse Project Explorer Filters
Join the DZone community and get the full member experience.
Join For FreeWondering why the Eclipse Project view might not show all files in the Project Explorer view? For example it shows this:
But on disk I have more files? Where are they?
:idea: 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:
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:
There is a ‘Customize View…‘ menu item:
And here I have the filters:
Now it should be clear why the files starting with a dot are ont shown: they are filtered out with the filter for “.*”:
Un-checking that filter will show now as well the dot files:
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:
Use the Add button to add a new filter:
To exclude just the ProjectInfo.xml:
- Exclude all (this will exclude all files matching my filter)
- Applies to Files (I only want to have it applied to files)
- [Name] [matches] the file name
With that, I can build any kind of filters.
Pressing OK, and it gets added to my filter list:
Now the ProjectInfo.xml is not listed any more in the Project Explorer view:
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 :-)
Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments