Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 362292

Summary: FileDialog fllter pattern without wildcard
Product: [Eclipse Project] Platform Reporter: Robin Rosenberg <robin.rosenberg>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: lshanmug, remy.suen
Version: 3.7.1   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Robin Rosenberg CLA 2011-10-28 06:50:22 EDT
This code won't work for me. I want the user to be able
to select either a file named "git" or one named "gitconfg" in
whatever directory the user chooses, but the dialog does not
enable selection of matching file names, they are greyed out
and so is the Open button.

FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN);
fileDialog.setText("Select the system-wide configuration file, or the git-executable");
fileDialog.setFilterExtensions(new String[] { "gitconfig", "git" });
String file = fileDialog.open();
Comment 1 Lakshmi P Shanmugam CLA 2011-10-28 08:57:40 EDT
It is working as designed. FileDialog.setFilterExtensions() sets the filter for the file extensions and not for the filename. So, in your example it is using the names as extensions. Please see its javadoc for details.
Comment 2 Robin Rosenberg CLA 2011-10-28 09:07:49 EDT
WORKSFORME can't be true if the dialog does not work for this case by design.

Any suggestion on how to solve this?