kaikramer / keystore-explorer

KeyStore Explorer is a free GUI replacement for the Java command-line utilities keytool and jarsigner.
https://keystore-explorer.org/
GNU General Public License v3.0
1.7k stars 275 forks source link

FileChooserFactory #288

Closed Colbix closed 3 years ago

Colbix commented 3 years ago

Is your feature request related to a problem? Please describe. FileChooserFactory and the implementation of JavaFXFileChooser classes.

Describe the solution you'd like Improve class to more closely align with JFileChooser and related classes.

Describe alternatives you've considered Bypassing FileChooserFactory entirely.

Additional context While attempting to implement other features in KSE I found that interacting with files produced inconsistent dialog presentations. When I see these inconsistencies my first thought is I have an incorrect implementation prior to the dialog call and it carrying over into the presentation. I used FileNameExtensionFilter, setAcceptAllFileFilterUsed, and setFileFilter expecting them to function properly however they did not work.

After examining the FileChooserFactory class I found the use of FileExtFilter class. My initial understanding of the FileExtFilter class is it produces similar results to the FileNameExtensionFilter class. Perhaps you could provide more insight for the class?

To summarize I was able to make changes to the FileChooserFactory and JavaFXFileChooser which will better align with the expected results when using JavaFX as the JFileChooser. The changes made also eliminates the need for the FileExtFilter class and searching the KSE project shows this class is limited to the classes I've mentioned. However I don't know the intention of the class, perhaps it is for backwards compatibility or to fulfill some other need. Anyway, thank you for your attention. I'll produce a PR with my proposed changes.

kaikramer commented 3 years ago

The first version of KSE is from 2004 and FileNameExtensionFilter was introduced in Java 6 (which was released in 2006 IIRC). So, it's just one of these "very old codebase things".

The changes you have described sound completely reasonable. Feel free to create the PR.