-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dear all,
I'm writing a small helper method to validate text input in a
GenericDialog. My idea is to return false if something other than a
valid number is entered into a numeric field, so then the
dialogItemChanged method will also return false, which greys out the OK
button and prevents the plugin from running. This was all very easy
until I tested a dialog that normally has a numeric field whose default
value is Double.POSITIVE_INFINITY.
This is represented by the '∞' character in the dialog, due to IJ.d2s:
<---
if (Double.isInfinite(n))
return ""+n;
- --->
If I try to construct a Double("∞") or run parseDouble("∞") I get a
NumberFormatException. Double(Double.POSITIVE_INFINITY).toString()
returns "Infinity".
It seems like GenericDialog handles this by looking the value up using
Interpreter, but I get lost about here.
At the moment, it looks like the most sensible thing to do is a
String.replace("∞", "Infinity") before using any of Double's methods.
Any suggestions on how to handle this better would be appreciated.
Michael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla -
http://enigmail.mozdev.org/iQEcBAEBAgAGBQJM7kYPAAoJED4GNP0caPn9dFsH/0XkmiY51aWx4nepwrEj6U7m
mTppJ9VnbrOgu1LzHuHfjgSfUTZiHsDYI9hoShcGpRetF0i8mBDNGPujI78/w8uP
pgBL2MWPClApYdCMjuUoLG1d813FdOrnHz4Z5Bx1vX2w0BhH/WJINmEsgEKK9NsQ
xqhFgxBTaxGCVuIKIVLNyetmux9CIJH92ARjeCGSOtpH+psY5WRPuwrwL7z5Ew0c
B9DFiI1uMUuevDNd9C0coC+qO1wveAU1VzMI9ulABNPRUmBHt+WhpxZdvHa8fJ9M
LIl3SgPrrMEbb9z2DFx01TYPd4Dw4SmygBEi7vtQQAOdU8+HfGsNKbNChAk6eHw=
=Vsk8
-----END PGP SIGNATURE-----