| Summary: | [Big Sur] File dialog does not change file name when switching file type | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Mikael Sterner <mikaels> | ||||
| Component: | SWT | Assignee: | Lakshmi P Shanmugam <lshanmug> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | alexandr.miloslavskiy, lshanmug, orionllmain, peter, thomasa, ts-swt, vicd, zefick | ||||
| Version: | 4.17 | ||||||
| Target Milestone: | 4.19 M3 | ||||||
| Hardware: | Macintosh | ||||||
| OS: | Mac OS X | ||||||
| See Also: |
https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/176014 https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=6200f83b8527d9fc8a48005cdd1b0626f1933490 https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/176336 https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=4f290a789051663e55e48c3d6d704f1cda15bb77 |
||||||
| Whiteboard: | |||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 569361 | ||||||
| Attachments: |
|
||||||
This looks like a Cocoa bug on BigSur. In FileDialog.sendSelection, (line 552) panel.setNameFieldStringValue(filename) is supposed to set the modified filename in the text field. The property nameFieldStringValue is being modified, but the text field is not updated. Opened Apple Bug for this issue: FB8909919 (BigSur: NSSavePanel setNameFieldStringValue doesn't update the text field in the panel) Should the Eclipse FileDialog implementation be setting an extension at all, in the filename field, on Mac? If no extension is specified in the filename field, then: * When the user commits, the extension is automatically chosen from the file format field. * There's no need to update it when the format changes. Maybe Apple's TextEdit provides a useful example for how the file dialog should work? * No extension appears automatically in filename field. * User can add an extension by hand, but that can result in a mismatch with the format field, which on commit leads to a dialog about the contradictory instructions. *** Bug 570830 has been marked as a duplicate of this bug. *** (In reply to Lakshmi P Shanmugam from comment #1) > This looks like a Cocoa bug on BigSur. > > In FileDialog.sendSelection, (line 552) > panel.setNameFieldStringValue(filename) is supposed to set the modified > filename in the text field. The property nameFieldStringValue is being > modified, but the text field is not updated. > > Opened Apple Bug for this issue: FB8909919 (BigSur: NSSavePanel > setNameFieldStringValue doesn't update the text field in the panel) Response from Apple on the ticket: As of Catalina, all apps have the sandbox versions of the Open/Save panels even if they are not sandboxed. This means you can't setNameFieldStringValue; an unsecure app might change the filename when the user was not expecting it. What you *are* allowed to do is return a name from panel:userEnteredFilename:confirmed: that has a different file extension, because that is a common pattern for non-sandboxed apps. This change went in Catalina 10.15.6. You can only change the extension when the user clicks Save. We are aware that changing extensions before that point is a common use case. You could try hiding extensions so the user doesn't see the mismatch between the popup and the name field. I'm trying to fix this using setAllowedFileTypes(), but has problems when using multi-part extension like tar.gz. Will look into it. New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/176014 Gerrit change https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/176014 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=6200f83b8527d9fc8a48005cdd1b0626f1933490 Fix is available in the latest build - https://download.eclipse.org/eclipse/downloads/drops4/I20210209-1800/ Please try it out. New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/176336 Gerrit change https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/176336 was merged to [R4_15_maintenance]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=4f290a789051663e55e48c3d6d704f1cda15bb77 Verified with I20210216-0600 |
Created attachment 284401 [details] Reproduce snippet To reproduce: 1. Run the snippet. 2. It opens a file dialog where the file edit field says "Untitled.png". 3. Select "Text File" in the file type combo box. This should change the file name to "Untitled.txt". On Big Sur this doesn't happen.