« Back

Eclipse Open Resource Dialog

Company Blogs November 20, 2007 By Minhchau Dang Staff

In Eclipse, everything is a plugin, including the IDE itself. So, if there's something which bothers you, all you need to do is replace the plugin with something which works in a way more consistent with your personal preferences, or if the plugin is open source, tweak the existing plugin to suit your needs.

In my case, what bothered me was this: I don't have any reason to look at .svn-base files or .class files, so I'd prefer they not show up. Playing with working sets doesn't solve the problem, because (as far as I know) there's no way to exclude .svn folders from the working set without adding all the files individually. I tried to add extension points, but I could never get the filters to show up. So, all other options exhausted, I went looking for a way to modify the source code.

In order to modify the "Open Resource" dialog, I needed to find the FilteredResourceSelectionDialog class found in the org.eclipse.ui.dialogs package in the org.eclipse.ui.ide Java archive. A bandwidth-intensive way to get the source code for that one source file was to download Eclipse Classic, and find it in the src.zip found under org.eclipse.ui.ide in the org.eclipse.platform.source folder.

I then overrode the matches method in FilteredResourceSelectionDialog.ResourceFilter to exclude all file names ending in .svn-base and .class, created a quick build file to include all the Eclipse plugins jars in my classpath, compiled, copied the resulting class files into the appropriate Java archive, and got this: a clean view showing only the files I might want to open.

Threaded Replies Author Date
This is very nice Minhchau. I always wanted to... Bruno Farache November 20, 2007 7:11 PM
Now updated with document library link! Minhchau Dang November 20, 2007 7:20 PM
Just realized that Eclipse Europa doesn't show... Bruno Farache November 21, 2007 6:13 AM
Hey Minhchau, this is very cool.. Can you fix... Ray Augé November 21, 2007 6:16 AM
File permissions should be fixed. Minhchau Dang November 21, 2007 12:00 PM
Minhchau, this is very nice. I've started to... Brian Chan February 28, 2008 9:21 AM

This is very nice Minhchau. I always wanted to get rid of these *.svn-base files.

Can you upload this modified class to somewhere?
Posted on 11/20/07 7:11 PM.
Now updated with document library link!
Posted on 11/20/07 7:20 PM in reply to Bruno Farache.
Just realized that Eclipse Europa doesn't show them too.
Posted on 11/21/07 6:13 AM in reply to Minhchau Dang.
Hey Minhchau, this is very cool.. Can you fix the permissions on the link so that we can dl it? I'd like to use this as well but get a permission error when trying to dl it. Thanks.

PS: If I were you, I'd submit this as a BUG/IMPROVEMENT to the Eclipse team. And also suggest that they implement filters in the prefs for that UI component.
Posted on 11/21/07 6:16 AM in reply to Minhchau Dang.
File permissions should be fixed.
Posted on 11/21/07 12:00 PM in reply to Ray Auge.
Minhchau, this is very nice. I've started to use Eclipse recently, and ran into the same issue. I started searching on this issue and to my surprise, the guy working next to me posted a solution months ago. Go figure.

Can you submit this to Eclipse so they can make it a setting? Good stuff.
Posted on 2/28/08 9:21 AM in reply to Minhchau Dang.