Contributing resource filters

The resource filters extension allows plug-ins to define filters that are useful for filtering out file types in the resource navigator view. This extension is useful when special file types are used to represent internal plug-in information but you do not want the files to be shown in the workbench or manipulated by the user.

The workbench filters out the pattern ".*" to exclude internal files such as .metadata from the resource navigator. Likewise, the JDT plug-in filters out "*.class" files to hide compiled classes.

The markup for the resource filters extension is simple.  The following is from the workbench plugin.xml.

<extension
         point="org.eclipse.ui.ide.resourceFilters">
      <filter
            selected="false"
            pattern=".*">
      </filter>
   </extension>

The filters can be enabled by the user using the resource navigator's local pull-down menu.

Resource filters menu

In addition to declaring the filter pattern, the plug-in can use the selected attribute to specify whether the filter should be enabled in the resource navigator.  This attribute only determines the initial state of the filter pattern.  The user can control which filter patterns are active.

Filter selection dialog