use of java.util.prefs.BackingStoreException in project tigervnc by TigerVNC.
the class UserPreferences method load.
public static void load(String nName) {
// Sets the value of any corresponding Configuration parameters
try {
Preferences node = root.node(nName);
String[] keys = node.keys();
for (int i = 0; i < keys.length; i++) {
String key = keys[i];
VoidParameter p = Configuration.getParam(key);
if (p == null)
continue;
String valueStr = node.get(key, null);
if (valueStr == null)
valueStr = p.getDefaultStr();
Configuration.setParam(key, valueStr);
}
} catch (BackingStoreException e) {
vlog.error(e.getMessage());
}
}
use of java.util.prefs.BackingStoreException in project tigervnc by TigerVNC.
the class UserPreferences method save.
public static void save(String nName) {
try {
Preferences node = root.node(nName);
node.sync();
String[] keys = root.keys();
for (int i = 0; i < keys.length; i++) vlog.debug(keys[i] + " = " + node.get(keys[i], null));
} catch (BackingStoreException e) {
vlog.error(e.getMessage());
}
}
use of java.util.prefs.BackingStoreException in project cayenne by apache.
the class CodeTemplateManager method updateCustomTemplates.
/**
* Updates custom templates from preferences.
*/
public void updateCustomTemplates(Preferences preference) {
String[] keys = {};
try {
keys = preference.childrenNames();
} catch (BackingStoreException e) {
logger.warn("Error reading preferences");
}
this.customTemplates = new HashMap<>(keys.length, 1);
for (String key : keys) {
FSPath path = new FSPath(preference.node(key));
customTemplates.put(key, path.getPath());
}
}
use of java.util.prefs.BackingStoreException in project cayenne by apache.
the class CayennePreferenceEditor method revert.
public void revert() {
// remove added preferences node
for (Preferences pref : addedNode) {
try {
pref.removeNode();
} catch (BackingStoreException ignored) {
}
}
cayenneProjectPreferences.getDetailObject(DBConnectionInfo.class).cancel();
restartRequired = false;
}
use of java.util.prefs.BackingStoreException in project cayenne by apache.
the class ChildrenMapPreference method initChildrenPreferences.
public void initChildrenPreferences() {
Map<String, Object> children = new HashMap<>();
try {
String[] names = getCurrentPreference().childrenNames();
for (String name : names) {
try {
Object newInstance = delegate.getClass().getConstructor(String.class, boolean.class).newInstance(name, true);
children.put(name, newInstance);
} catch (Throwable e) {
throw new CayenneRuntimeException("Error initializing preference", e);
}
}
this.children.putAll(children);
} catch (BackingStoreException e) {
e.printStackTrace();
}
}
Aggregations