-
Notifications
You must be signed in to change notification settings - Fork 11
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
File widgets: sort list in drag-and-drop operation #66
base: master
Are you sure you want to change the base?
Conversation
I tested the current behavior on macOS, and dragging from Finder, the order is consistent with how the files are listed/sorted, which seems like a good thing to me. When sorted by "Date Modified" for example, I would expect the files to drop into Fiji in that same order: the order they appear listed in Finder. Which file systems provide files in an unsorted way? Perhaps we could sort only for those file systems? |
Thanks, @ctrueden, for testing. My use case was on Windows with a samba-mounted GPFS. I should have specified that I was dragging a single folder onto the Add folder content... button. In this case, you don't have an open Explorer window with a custom sorting. I can confirm that when dragging multiple selected files the order of the files is conserved from how they're listed in Explorer. So I guess the default sorting should be implemented for the folder content button only, which would be here: scijava-ui-swing/src/main/java/org/scijava/ui/swing/widget/SwingFileListWidget.java Lines 276 to 292 in 7bde4b2
Do you agree? I can update this PR accordingly. |
Yes, that seems right to me (although I didn't have time to test it).
Thanks! |
75109d1
to
2c129be
Compare
@ctrueden, I updated this pull request to only sort the file list when adding the (possibly filtered) content of an entire folder to the file list. (Sorry I didn't have a chance to test extensively with the samba-mounted file system yet because I'm currently traveling.) |
Some file systems provide files in an unsorted way, resulting in e.g. the
FileListWidget
containing an unordered list when folder content is added. This pull request aims to improve user experience by always sorting the list of files returned bySwingFileWidget.getFiles()
.