Can a Tool access Preferences?

This page about developing a tool mentions

What Tools Can and Cannot Do

The following classes have been sufficiently documented for use in Tool classes:

processing.app.Base

The base class for the main Processing application.

processing.app.ui.Editor

Main editor panel for the Processing Development Environment.

processing.app.Preferences

Storage class for user preferences and environment settings.

processing.app.Sketch

Stores information about files in the current sketch

processing.app.SketchCode

Represents a single tab of a sketch.

but includes no further details. So what would be the approach to access Preferences? I would like my tool to have a few settings. I also developed the Video Export library and remember struggling a lot finding a place where to store settings. First I used a generic Java approach, but then I was surprised to find out it was failing under Windows, so I hacked a way to figure out the library location and write a json file there. It would be nice if there was a preferences getter/setter provided by the IDE. Is there one?

Meh… forget my question. The answer is too simple :slight_smile:

Nothing like asking to figure out the answer yourself.

So it turns out everything in Preferences is static. So I can just

Preferences.get("bla"); 

from the Tool.

1 Like