Re: using path hint in javax.jnlp's openFileDialog
On Mar 26, 9:05 pm, David Lamb <dal...@cs.queensu.ca> wrote:
...I've just implemented the action for
opening a file using the openFileDialog of the file opening service,
...I've not been
able to find any explanation of how to use the path hint parameter,
AFAIU, it is the path of a directory.
though; the javadocs and tutorial just say it's a hint and nothing about
what sort of hint to give, other than supplying "null" for default
behaviour.
Can anyone tell me how to use this parameter?
Supply the absolute path to a directory.
.. Can it be used to, for
example, start the next dialog in the same directory as the previous one?
Nope, not as far as I can see. Since neither the
FileOpenService or FileContents will provide the path
to the resource the user chose (only its name, in the
case of FileContents) it is impossible to get the path
for the current FOS.
About the only place I can see the file hint being
useful is in:
a) Secure code where we can supply things like ${user.home}
explicitly, or
b) When using the FS or the ExtendedService with a File
that we already know the path of. E.G. when the app.
has a File association defined & the user 'double clicks'
an associated file type, the entire path of that File is
supplied as an argument to the main(String[]).
Actually, my point 'a' is a bit disingenuous, since it
would require all-permissions to get the values of the
secure properties, we might as well just use a standard
JFileChooser and be done with it.
--
Andrew T.
pscode.org