Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 570830 - FileDialog extension selector doesn't work on macOS Catalina/Big Sur
Summary: FileDialog extension selector doesn't work on macOS Catalina/Big Sur
Status: CLOSED DUPLICATE of bug 567754
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.19   Edit
Hardware: All Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-02 02:20 EST by John Kozlov CLA
Modified: 2021-02-02 02:34 EST (History)
1 user (show)

See Also:


Attachments
GIF that demonstrates the bug (171.02 KB, image/gif)
2021-02-02 02:20 EST, John Kozlov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Kozlov CLA 2021-02-02 02:20:27 EST
Created attachment 285428 [details]
GIF that demonstrates the bug

FileDialog doesn't change Temp.png to Temp.bmp in the file name field when I change PNG to BMP in the extension selector. Please see the attached GIF.

The bug is reproduced on Catalina and Big Sur but not reproduced on old High Sierra (High Sierra changes the file name as expected).

Manual editing in the file name field works OK.

You can use this code to reproduce the bug:

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;

public class Main {

    public static void main(String[] args) throws Exception {
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setText("File Dialog Example");
        shell.setLayout(new FillLayout());
        shell.open();

        FileDialog fileDialog = new FileDialog(shell, SWT.SAVE);
        fileDialog.setText("File dialog text");
        fileDialog.setFilterNames(new String[] {"PNG (*.png)", "BMP (*.bmp)" });
        fileDialog.setFilterIndex(0);
        fileDialog.setFileName("Temp");
        fileDialog.setFilterPath("/Users/<user>/Documents");
        fileDialog.setFilterExtensions(new String[] {"*.png", "*.bmp" });
        String result = fileDialog.open();
        System.out.println(result); // Always prints Temp.png on Catalina/BigSur

        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
        display.dispose();
    }
}
Comment 1 Thomas Wolf CLA 2021-02-02 02:34:35 EST

*** This bug has been marked as a duplicate of bug 567754 ***