| Summary: | FileDialog's overwrite & setFilterExtensions options do not play well together. | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Robert Konigsberg <konigsberg> |
| Component: | SWT | Assignee: | Abhishek Kishore <abhishek.kishore> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | abhishek.kishore, arunkumar.thondapu, ob1.eclipse, pinnamur, remy.suen |
| Version: | 3.7 | ||
| Target Milestone: | 4.4 M7 | ||
| Hardware: | Macintosh | ||
| OS: | Mac OS X | ||
| See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=529227 | ||
| Whiteboard: | |||
Perhaps this is an OS thing, not sure. SWT, please advise. Rob, I'm guessing this is Cocoa, correct? I kinda doubt it's OS-related. But it's Cocoa. I ran this on Windows XP. I typed "test" and it gave me "...\test" (unlike comment 0) even though I had a "...\test.epf" file in that folder. It didn't prompt me to overwrite...but I guess since the returned value isn't "test.epf" there was actually no overwriting involved. Entering in "test.epf" doesn't prompt me though. So there's definitely a bug here. Very odd. Display display = new Display(); Shell shell = new Shell(display); FileDialog dialog = new FileDialog(shell); dialog.setOverwrite(true); dialog.setFilterExtensions(new String[] { "*.epf" }); System.out.println(dialog.open()); shell.dispose(); display.dispose(); Looks like this might be broken on Linux also. See bug 332178. I knew this sounded familiar... Bug 348233 will fix this problem for at least Windows Vista and Windows 7. (In reply to Remy Suen from comment #3) > I ran this on Windows XP. I typed "test" and it gave me "...\test" (unlike > comment 0) even though I had a "...\test.epf" file in that folder. It didn't > prompt me to overwrite...but I guess since the returned value isn't > "test.epf" there was actually no overwriting involved. > > Entering in "test.epf" doesn't prompt me though. So there's definitely a bug > here. Very odd. > > Display display = new Display(); > Shell shell = new Shell(display); > FileDialog dialog = new FileDialog(shell); > dialog.setOverwrite(true); > dialog.setFilterExtensions(new String[] { "*.epf" }); > System.out.println(dialog.open()); > shell.dispose(); > display.dispose(); setOverWrite() matters only for Save dialogs(style SWT.SAVE). So, with the above code, the user will not be prompted, irrespective of the platform and filter. Bug 332178 talks specifically about a Save dialog as well. I'm assuming the bug was reported was reported for a Save dialog. I'm able to recreate the issue on a Mac OS X Mavericks platform - typing "test.epf" prompts me, but entering "test" doesn't(I have a filter - "*.epf"). Also, its working fine on Windows 7 for me. Arun, https://git.eclipse.org/r/#/c/23299 waiting for your review. (In reply to Abhishek Kishore from comment #7) > Arun, https://git.eclipse.org/r/#/c/23299 waiting for your review. Please note that this patch should fix Bug 428216 as well. Review comments have been incorporated, and changes have been committed - http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=d2444ea11626b1e659e4e7a174b1438fa903c689 |
Build Identifier: I20110310-1119 org.eclipse.swt.widgets.FileDialog -- fd.setOverwrite(true); fd.setFilterExtensions(new String[] { "*.epf" }); String file = fd.open(); OK so if i have a file called "asdf.epf", and in this dialog I enter "asdf", it does not give me an overwrite warning. However, when fd.open returns, it returns "asdf.epf". So it's now returning a file which will be overwritten, yet I wasn't prepared for it. Reproducible: Always