use of java.util.prefs.BackingStoreException in project hale by halestudio.
the class CustomTileMapServerConfiguration method load.
/**
* Load configuration with the given name
*
* @param name the configuration name
*
* @return if loading the configuration succeeded
*/
public boolean load(String name) {
Preferences preferences = getPreferences();
try {
if (preferences.nodeExists(name)) {
Preferences node = preferences.node(name);
setName(name);
loadProperties(node);
return true;
} else {
// $NON-NLS-1$ //$NON-NLS-2$
log.warn("No configuration named " + name + " found");
return false;
}
} catch (BackingStoreException e) {
// $NON-NLS-1$
log.error("Error loading CustomTile configuration");
return false;
}
}
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();
}
}
use of java.util.prefs.BackingStoreException in project cayenne by apache.
the class ChildrenMapPreference method save.
public void save() {
if (removeObject.size() > 0) {
for (String aRemoveObject : removeObject) {
try {
delegate.getCurrentPreference().node(aRemoveObject).removeNode();
} catch (BackingStoreException e) {
throw new CayenneRuntimeException("Error saving preference");
}
}
}
for (Map.Entry<String, Object> pairs : children.entrySet()) {
delegate.getCurrentPreference().node(pairs.getKey());
((CayennePreference) pairs.getValue()).saveObjectPreference();
}
}
Aggregations