-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added an option to overrule the last file dialog location on Windows #466
Added an option to overrule the last file dialog location on Windows #466
Conversation
Thanks for the PR to fix the issue. Do we need a new API here to fix the Windows behavior? |
When I change the default way on Windows, someone will only revert it back as in #142. That is why I added an optional switch. However, I am open to suggestions on how to change the API. |
AFAICS from https://bugs.eclipse.org/bugs/show_bug.cgi?id=577190#c17 the change was reverted because it caused 2 other issues as mentioned in the comment there.
|
Is there consensus for |
Can you pls verify your fix based on above points?
Please see #466 (comment) above, the fix should go into |
If you make it configurable then I think there's a strong case for defaulting It would be preferable to simply revert the behavior to <4.20 (ie |
Let me try to summarize all information, as I'm getting lost in all the spread-out information in various issue, pull requests, etc. Background:
There may be a related or unrelated issue with root / 'This PC' / 'Computer' directory:
Potential reasons to make it always a hard override:
Potential reasons for reverting the change and keeping the current behavior, or supporting a hybrid approach as per this pull request:
Regarding whether this is a regression, there is mixed evidence:
Options for the design:
Possible implementations for hard override:
Possible defaults for a hard override option:
|
There appears to be conflicting evidence regarding the behavior on 4.16: I have re-run the tests for 4.16 and additional ones for 4.13, 4.14 and 4.15. All of these versions work as a hard override for me on Windows 10, using the same snippet for testing (https://bugs.eclipse.org/bugs/show_bug.cgi?id=577190#c19). Can someone please help verify if we actually have inconsistent behavior on 4.16, or if the previous report of 4.16 working as a soft default was a mistake? |
https://bugs.eclipse.org/bugs/show_bug.cgi?id=577190#c19 uses two different paths for the |
I can not reproduce this behavior. Calling with Tested with: https://archive.eclipse.org/eclipse/downloads/drops4/R-4.16-202006040540/ Update: I'm actually getting inconsistent results and can sometimes reproduce the behavior you describe when switching around between the JDK versions used to compile and/or run. But using SWT 4.16 and compiling and running with Java-17 results in a hard override, even when calling twice with |
805e2d6
to
2af4f8e
Compare
I have a hard time seeing how to proceed from all those conflicting comments. I now merged the parameter into the existing |
I think the main priority is to get back some option to achieve "override" behavior on all systems, whether that's by default or by using an additional parameter isn't overly important imo. From my point of view it would be preferable to have |
2af4f8e
to
b36e997
Compare
Set |
b36e997
to
8732782
Compare
8732782
to
f0dc0a8
Compare
AFAIU the main usecase for having an API is to provide an option in FileDialog to store the last saved location. But, that should be the default behavior of FileDialog, it should remember the last opened directory see issue So, 2 changes are required in FileDialog on Windows here:
This would fix the current problem with FileDialog.setFilterPath(), make it consistent across all platforms and provides a way for users to switch between the behaviors. |
Note: there is also a competitive #530. |
I am not sure if I understand your suggested changes. Added a new change set which hopefully goes into the right direction. |
f0dc0a8
to
aab77c5
Compare
Thanks, the change is in the right direction, but point 2 below is not covered. Let me explain.
With the current PR, if a FileDialog is opened without any call to setFilterPath(), the FileDialog would open at the Windows "root" directory and last opened directory will not be remembered, hence bringing back #95. For example: try the snippet in #95 (comment). @deepika-u, I don't have Windows to test the PR, can you pls give it a try? |
IMHO the path remembering only should happening if |
@tmssngr Not sure which request you are referring to. My comment was requesting to remember the path when |
I have tested your new change that fixes the original issue but when filterPath is not set, we are loosing the original behavior as conveyed by @lshanmug(it is not remembering the history of last saved path). |
@deepika-u Thanks for testing. Will this fix the problem?
|
@Mailaender |
The needed changes are tested and merged with pr => #556 Thanks everyone! please let me know if that works for you. |
Thanks @deepika-u for the fix! Can you please test with Snippet 72 with different combinations of setFilterPath() ?
Also, pls verify in Eclipse with tomorrow's I-build. |
Test cases i tried are as below ::
General testing : This issue is fixed via the pr #556 => #556 The fix is now available in RC1. You may please test this fix and let us know your feedback. |
Alternative fix #556 is in. |
As suggested in https://bugs.eclipse.org/bugs/show_bug.cgi?id=577190 I made it configurable, so hopefully everyone is happy. The main reason is that it is inconsistent across platforms (only Windows "misbehaves") and your application may want to store the last saved location on its own per perspective / data type etc.
To test, run
Snippet72
on Windows. Select a file from another folder sayC:\Windows\win.ini
. Run it twice to verify it uses the preset location. RemovesetFilterForcePath
to bring back the legacy behavior where it by default will just ignore the set filter path if you used any save dialog before.