Neel
Neel

Reputation: 2100

Eclipse: Hide files excluded from source folder

I have multiple files of different types in a source folder in my Eclipse project (not a Java project). I know how to hide files from the Project Explorer view (using view filters). But I did not find a way to hide (not exclude) a file from the source folder. Is that possible to achieve?

Example:

Say my project has a folder: src, which contains three files: Main.java, and config1.xml, config2.xml. Once I add src as a source folder, it along with its file children show up as source folder (see upper balloon in image) and also a simple folder (separately) (see lower balloon in image) under the same project in Project Explorer.

enter image description here

I know that I can set an inclusion filter so that I build only the java file, and not the xml. But how can I set a view filter so that the config1.xml file is hidden, but not config2.xml? (Clearly, I do not want to set a filter on *.xml, because that would hide both xml files.

UPDATE: When I attempt to add a resource filter according to Simon's solution, the file gets hidden from both the source folder and the folder view. I want to hide it only from the source folder view (upper balloon) and not the simple folder view (lower balloon). That way we know about the existence of config1.xml, but its exclusion from source.

enter image description here

Upvotes: 2

Views: 2019

Answers (1)

Simon Arsenault
Simon Arsenault

Reputation: 1261

If you want the file to be hidden from the view, then do the following

  • Open the context menu on the "src" folder and select Properties
  • Choose Resource > Resource Filters page
  • Click the "Add" button.
  • In the dialog, select "Exclude all" filter type option, "Files" applies to option, and type in the file name config1.xml (Name matches)
  • Close all the dialogs and refresh your project in the Project Explorer view.

The file config1.xml should no longer be visible

Upvotes: 4

Related Questions