Community
Participate
Working Groups
Pre-Condition: There are a lot of files and folders added to eclipse Action: 1. To filter only specific files and folders create Resource Filter 2. Select "Filter type" as "Include only" 3. Select "Applies to" as "Files and folders" 4. Select "All children (recursive)" 5. Select "File and Folder Attributes" 6. In Filter Details select "Project Relative Path" "matches" 7. Enter the path eg: blah/* Expected: folder and files under blah need to be shown Actual Result: folder and files under blah are NOT being shown This issue is occuring all the time Note: At step 3 if Select "Applies to" is set as "Files" then folder and files under blah are being shown. This setting has side effect it shows other unwanted folders also. -- Configuration Details -- Product: Eclipse IDE 4.13.0.20190917-0000 (org.eclipse.epp.package.cpp.product)Installed Features: org.eclipse.platform 4.13.0.v20190916-1323
It seems to me that the view you are using is not provided by Eclipse Platform. - In which view are you trying to make this filter? e.g. 'Project Explorer' - Where is the 'create Resource Filter' button/menu located?
(In reply to Rolf Theunissen from comment #1) > It seems to me that the view you are using is not provided by Eclipse It _is_ provided by platform. Open the properties on any Eclipse project in project explorer or package explorer; there it's under Resource->Resource Filters. (In reply to pav48856 pav48856 from comment #0) > 7. Enter the path eg: blah/* > > Expected: folder and files under blah need to be shown > > Actual Result: folder and files under blah are NOT being shown That filter excludes the top-level folder "blah" itself since "blah" doesn't match "blah/*". You could combine it using an OR group with a filter to include "blah", too. Or, depending on your folder names, you could use the single filter you defined but use the pattern "blah*" (without the slash), but that would also include a folder called "blahblah".
Created attachment 282481 [details] Resource Filter Settings
(In reply to Thomas Wolf from comment #2) The project I am working has lots of source files & folders. The folder names are repeated at several locations. My goal is to include files under specific directories into the eclipse project. So that eclipse can only index these files and also browsing will be easy for me. Can you please let me know how i can achieve this. Is using Resource Filters>>Include Only is the best approach? eg: folders vendor/abc/ vendor/xyz/ drivers/abc/ drivers/xyz I would like to include only these files only in to my eclipse project vendor/abc/ drivers/xyz/ Note: This is just simple example. I am new to eclipse, your help is very much appreciated.
For this example you could use two "include only" filters, files & folders, recursive, project-relative path matches, with the regular expression patterns vendor(/abc(/.*)?)? drivers(/xyz(/.*)?)? This is because the pattern must match the parent folders, too. If a parent folder doesn't match, it and all its children are pruned because the file tree is traversed and filtered top-down. This is why a simpler pattern like vendor/abc* wouldn't work: it doesn't match the first-level folder "vendor", so the traversal never even gets to vendor/abc, much less the children of that.
(In reply to Thomas Wolf from comment #5) > For this example you could use two "include only" filters, files & folders, > recursive, project-relative path matches, with the regular expression > patterns > > vendor(/abc(/.*)?)? > drivers(/xyz(/.*)?)? > > This is because the pattern must match the parent folders, too. If a parent > folder doesn't match, it and all its children are pruned because the file > tree is traversed and filtered top-down. This is why a simpler pattern like > vendor/abc* wouldn't work: it doesn't match the first-level folder "vendor", > so the traversal never even gets to vendor/abc, much less the children of > that. Thanks for the info. Sorry for my delayed reply, i tried it out this is working. This solution seems a bit complex for people who are not familiar with regular expressions. Is there any simple way without using regex? It will be nice, if the same result can be achieved by just mentioning the relative path of the whole directory which needs to be included.
If you prefer non-regexes, you could try or-ing filters: * OR * vendor * vendor/abc * vendor/abc/* * OR * drivers * drivers/xyz * drivers/xyz/*
Tried out this method also works. But it will become tedious when the paths are big. I would really recommend if eclipse can just accept the path and do all the necessary work by itself then it becomes quite easy usable for the end user. Other editors are functioning this way. Please consider this as a feature request/enhancement. Let me know if i need to raise a separate ticket for this request/enhancement.