Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362292 - FileDialog fllter pattern without wildcard
Summary: FileDialog fllter pattern without wildcard
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-28 06:50 EDT by Robin Rosenberg CLA
Modified: 2011-10-31 08:13 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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?