Settings的说明

Plugin-specific settings, used internally as well as by the user, are managed via the Preferences
class or the IPreferenceStore class in Eclipse RCP, which is set up via the Activator class. The
NetBeans Platform takes a slightly different approach. Managing settings is handled by the Java
Preferences API. Access to the Preferences instance is obtained via the NbPreferences class. An
advantage of this implementation is that data is stored in the NetBeans Platform user direc-
tory.
A distinction is made between module-specific data and application-specific data. The
root() method gives access to settings saved in the config/Preferences.properties file. The
forModule() method, on the other hand, handles access to data found in module-specific
properties files. For example, if the code name base is com.galileo.netbeans.module, settings
will be stored in the config/Preferences/com/galileo/netbeans/module.properties file.
NbPreferences.forModule(MyClass.class).put("key", "value");
NbPreferences.root().put("key", "value");
You can find more detailed information on this topic in Chapter 9.
原文地址:https://www.cnblogs.com/cuizhf/p/2216330.html