Merge pull request #1566 from APriestman/collaborative

Adding manual save and load to UserPreferences
This commit is contained in:
Richard Cordovano 2015-09-11 14:13:51 -04:00
commit 4e73b26eff

View File

@ -18,6 +18,7 @@
*/ */
package org.sleuthkit.autopsy.core; package org.sleuthkit.autopsy.core;
import java.util.prefs.BackingStoreException;
import org.sleuthkit.autopsy.events.MessageServiceConnectionInfo; import org.sleuthkit.autopsy.events.MessageServiceConnectionInfo;
import java.util.prefs.PreferenceChangeListener; import java.util.prefs.PreferenceChangeListener;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
@ -58,6 +59,27 @@ public final class UserPreferences {
private UserPreferences() { private UserPreferences() {
} }
/**
* Reload all preferences from disk. This is only needed if the preferences
* file is being directly modified on disk while Autopsy is running.
*
* @throws BackingStoreException
*/
public static void reloadFromStorage() throws BackingStoreException {
preferences.sync();
}
/**
* Saves the current preferences to storage. This is only needed if the
* preferences files are going to be copied to another location while
* Autopsy is running.
*
* @throws BackingStoreException
*/
public static void saveToStorage() throws BackingStoreException {
preferences.flush();
}
public static void addChangeListener(PreferenceChangeListener listener) { public static void addChangeListener(PreferenceChangeListener listener) {
preferences.addPreferenceChangeListener(listener); preferences.addPreferenceChangeListener(listener);
} }