private static Type chooserType(FileChooserDialog chooser) {
    return chooser instanceof NativeFileChooserDialogImpl ? Type.NATIVE :
           chooser instanceof NewFileChooserDialogImpl ? Type.NEW :
           chooser instanceof FileChooserDialogImpl ? Type.CLASSIC :
           Type.OTHER;
  }
private static Type chooserType(FileChooserDialog chooser)