In fact even that does not work. I am confronted with an evil choice of either always seeing the last, updated value in the Preferences panel, but then not able to retrieve the correct value using Option.getValue(). Or getting the correct value using Option.getValue(), but then seeing the value stubbornly return to its initial value in the Preferences tab. This has been rather a fight with the API.
"Error whilst reading memory file" when clicking OK or Apply in Preferences tabs
I already had a conversation about this issue with Peter Tsai (not via this forum). See https://support.geneious.com/hc/en-us/requests/29878
In short: whenever I change the value of an "Option" in our plugin's tab panel in Tools -> Preferences, and whenever I press Apply or OK in that panel, I guet the message "Error whilst reading memory file".
The conclusion from your dev team was that the above message was pretty harmless.
However I'v now discovered that the consequence of Geneious emitting this message is that code reading the value of the Options on the Options panel get the wrong value.
To be more precize: For any Geneious session you can change the value once, and you still get the right value when calling Options.Option.getValue(). After that it just keeps giving you back that particular value, however often you update the value for that option afterwards.
There is a work-around: attach a change listener to every option and make that listener copy the new value to some sort of Memento object. The change listener does get triggered by a user update. However that's pretty laborious.
Please sign in to leave a comment.
I'm the developer who Peter consulted on your support request.
To be totally clear, this is happening in a subclass of PluginPreferences that you've written, not in an Options dialog from running a DocumentOperation subclass (or SequenceAnnotationGenerator, etc.)?
I suspect the "Unable to determine max memory...Error whilst reading memory file" warning isn't actually the cause of the symptoms you're observing, but it might be related (I'm not sure how, but both symptoms are weird, so it seems likely). That particular message is logged, but the method where panel preferences are saved soldiers on anyway.
However, it's hard for me to tell what could be causing your preferences to fail to apply. Are you also getting a message along the lines of "Error in [plugin tab label]"?
It would be helpful if you could open a new support request (please mention me if you do). I'd like to have a build of your plugin (as a .gplugin file) so I can install it and see where exactly it's returning early when applying preferences.
Sorry, was on another project for a few days. OK, I will create a new support request. But yes, it happens when doing any action in our tab in the Tools -> Preferences page. The PluginPreference subclass doesn't do much, but the creatOptions method returns an Options subclass which might be the culprit. Here is its github URL: https://github.com/naturalis/sd_java__geneious_plugin/blob/v2_master/importers/src/main/java/nl/naturalis/geneious/NaturalisOptions.java