Skip to content

Commit

Permalink
Fix syncing of preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
PyvesB committed Jul 16, 2024
1 parent dd1ce86 commit db3d39d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
*******************************************************************************/
package io.github.pyvesb.eclipse_solargraph.preferences;

import org.osgi.service.prefs.BackingStoreException;

import io.github.pyvesb.eclipse_solargraph.utils.LogHelper;

public enum BooleanPreferences implements Preference<Boolean> {

UPDATE_GEM("AutoUpdate", "Automatically update gems", true),
Expand Down Expand Up @@ -51,6 +55,11 @@ public Boolean getDef() {
@Override
public void setValue(Boolean value) {
PREFERENCES.putBoolean(key, value);
try {
PREFERENCES.sync();
} catch (BackingStoreException e) {
LogHelper.error("Exception whilst persisting preference " + this.getKey(), e);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

import static io.github.pyvesb.eclipse_solargraph.utils.CommandHelper.isWindows;

import org.osgi.service.prefs.BackingStoreException;

import io.github.pyvesb.eclipse_solargraph.utils.CommandHelper;
import io.github.pyvesb.eclipse_solargraph.utils.LogHelper;

public enum StringPreferences implements Preference<String> {

Expand Down Expand Up @@ -55,6 +58,11 @@ public String getDef() {
@Override
public void setValue(String value) {
PREFERENCES.put(key, value);
try {
PREFERENCES.sync();
} catch (BackingStoreException e) {
LogHelper.error("Exception whilst persisting preference " + this.getKey(), e);
}
}

}

0 comments on commit db3d39d

Please sign in to comment.