Sean Reilly on 27 May, 2019 08:39 AM
To get a native file dialog you can use the java.awt.FileDIalog class. Although be warned that setting a filename filter on a file dialog when running on a mac will cause a freeze and possibly a crash on some recent versions of macOS.
You could also use a JFileChooser to get the swing file selector. That's not "native" and is pretty awful on the mac, but I think it's a decent option on windows.
Thanks. For the record, here’s what I ended up with, with less dependencies. Haven’t tried on non-MacOS.
The difficulty that prevented me from just trying this earlier was to get the parent frame (topFrame) in the code below. Is this the recommended way? I would have thought that MD would provide that somewhere for an extension.
The information available to extension authors is quite sparse, it is more of a try and see using the available Javadoc. I have written a few notes on what I have worked out (see https://bitbucket.org/mikerb/moneydance-2019/wiki/Home). The parent frame is not readily available to an extension.
Although not a hang, I encountered a problem when using a filename extension filter with JFileChooser on Mac OS (Mojave) -- the dialog display did not appear at all. The JVM was still running and the UI was interactive, just no popup dialog box at all.