Can you get Processing to recognize that a tool has updated the preferences?
in
Library and Tool Development
•
2 years ago
I'm writing a really simple little tool to open the current sketch in another editor. Right now, it just checks whether the "editor.external" perference is set to true. If not, it warns the user, and tells them to set it themself.
But I'd much rather just have the tool set the preference to true (if there are no unsaved changes, etc.), and then do its open-sketch-elsewhere stuff.
I can easily set the preference, but that doesn't make it take effect. And I can't find any way of getting Processing to recognize the change. I.e. all I'd like to do is this:
- Preferences.setBoolean( "editor.external" , true ); // this works just fine, but doesn't take effect by itself
- editor.applyPreferences(); // compile error - applyPreferences() is protected
Why is Editor.applyPreferences() even protected? And how can an instance of Preferences call it just fine from Preferences.applyFrame(), when I can't?
Update: Derp... Preferences can of course call Editor.applyPreferences, since they're in the same package. However, that doesn't alter the fact, that it doesn't make sense.
If a tool can alter preferences, why can't it make them take effect? Alternatively: If a tool can't make preferences take effect, why can it change them?
1