Bug 576984 - [win32] FileDialog does not add file extension
Summary: [win32] FileDialog does not add file extension
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.20   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 4.22 M3   Edit
Assignee: Nikita Nemkin CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-10-31 16:07 EDT by Chris Stamm CLA
Modified: 2021-11-11 08:01 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Stamm CLA 2021-10-31 16:07:54 EDT
Since version 4.20 the FileDialog(shell, SWT.SAVE) doesn't add an extension to a file name displayed in the dialog.
This problem occurs only if the set file name does not have an extension. Till version 4.19 the extension of the chosen filter index has been added automatically.

static final String[] SAVE_FILTER_EXTENSIONS = new String[] {
		"*.bmp", "*.gif", "*.ico", "*.jpg", "*.png", "*.tif" };
static final String[] SAVE_FILTER_NAMES = new String[] {
		"BMP (*.bmp)", "GIF (*.gif)", "ICO (*.ico)", "JPEG (*.jpg)", "PNG (*.png)", "TIFF (*.tif)" };

FileDialog fileChooser = new FileDialog(shell, SWT.SAVE);
fileChooser.setFilterExtensions(SAVE_FILTER_EXTENSIONS);
fileChooser.setFilterNames(SAVE_FILTER_NAMES );
fileChooser.setFileName("testName");
fileChooser.setFilterIndex(0);
String fileName = fileChooser.open();
Comment 1 Dominik G. CLA 2021-11-08 10:33:16 EST
The problem occurs at many places all over our RCP based product after an update to 4.20.
Users who change the proposed filename in the FileDialog and do not include the extension within the filename will have a file without extension even if a unique filter extension was selected inside the save dialog.
In previous versions the file extension was also part of the returned filepath of the FileDialog class.
Should we handle/fix this changed behaviour on our side or is this change an unwanted side effect from Bug 571571 and will be fixed in the next version?
Comment 2 Andrey Loskutov CLA 2021-11-08 15:21:11 EST
(In reply to Dominik G. from comment #1)
> Should we handle/fix this changed behaviour on our side or is this change an
> unwanted side effect from Bug 571571 and will be fixed in the next version?

Please ask same question on bug 571571.
Comment 3 Nikita Nemkin CLA 2021-11-09 02:00:09 EST
This is a bug, I'll upload a fix shortly.

Platform is frozen for M3 right now, the fix will go into 4.22 RC1.
Comment 4 Eclipse Genie CLA 2021-11-09 02:06:14 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/187534
Comment 5 Andrey Loskutov CLA 2021-11-09 02:15:43 EST
(In reply to Nikita Nemkin from comment #3)
> This is a bug, I'll upload a fix shortly.
> 
> Platform is frozen for M3 right now, the fix will go into 4.22 RC1.

The M3 will be declared on Thursday, and change looks small enough to be "in".
Comment 6 Nikita Nemkin CLA 2021-11-09 02:29:27 EST
(In reply to Andrey Loskutov from comment #5)
> (In reply to Nikita Nemkin from comment #3)
> > This is a bug, I'll upload a fix shortly.
> > 
> > Platform is frozen for M3 right now, the fix will go into 4.22 RC1.
> 
> The M3 will be declared on Thursday, and change looks small enough to be
> "in".

I can't override it. Feel free to merge the fix if you can.
Comment 7 Andrey Loskutov CLA 2021-11-10 03:42:24 EST
(In reply to Nikita Nemkin from comment #6) 
> I can't override it. Feel free to merge the fix if you can.

Looks like Gerrit doesn't send mails after update. I've verified the fix, thanks.
Niraj: any objections to merge?
Comment 9 Andrey Loskutov CLA 2021-11-10 04:50:10 EST
Thanks Nikita & Niraj!
Comment 10 Niraj Modi CLA 2021-11-11 08:00:35 EST
@Phil: Could you please verify the fix with latest Eclipse I-Build:
https://download.eclipse.org/eclipse/downloads/drops4/I20211110-1800 ? Thanks!
Comment 11 Niraj Modi CLA 2021-11-11 08:01:57 EST
(In reply to Niraj Modi from comment #10)
> @Phil: Could you please verify the fix with latest Eclipse I-Build:
> https://download.eclipse.org/eclipse/downloads/drops4/I20211110-1800 ?
> Thanks!

Please ignore above.