|
1 | 1 | package io.snyk.eclipse.plugin.properties.preferences; |
2 | 2 |
|
3 | | -import org.apache.commons.lang3.SystemUtils; |
4 | | -import org.eclipse.jface.preference.IPreferenceStore; |
5 | | - |
6 | | -import io.snyk.eclipse.plugin.EnvironmentConstants; |
7 | | -import io.snyk.languageserver.LsRuntimeEnvironment; |
| 3 | +import static io.snyk.eclipse.plugin.utils.FileSystemUtil.getBinaryDirectory; |
8 | 4 |
|
9 | 5 | import java.io.File; |
10 | 6 | import java.util.Optional; |
11 | 7 | import java.util.UUID; |
12 | 8 |
|
13 | | -import static io.snyk.eclipse.plugin.utils.FileSystemUtil.getBinaryDirectory; |
| 9 | +import org.apache.commons.lang3.SystemUtils; |
| 10 | +import org.eclipse.jface.preference.IPreferenceStore; |
| 11 | + |
| 12 | +import io.snyk.eclipse.plugin.EnvironmentConstants; |
| 13 | +import io.snyk.languageserver.LsRuntimeEnvironment; |
14 | 14 |
|
15 | 15 | public class Preferences { |
16 | 16 | static Preferences CURRENT_PREFERENCES; |
@@ -46,6 +46,10 @@ public static synchronized Preferences getInstance(PreferenceStore store) { |
46 | 46 | public static final String LSP_VERSION = "LSP_VERSION"; |
47 | 47 | public static final String USE_TOKEN_AUTH = "useTokenAuth"; |
48 | 48 | public static final String ANALYTICS_PLUGIN_INSTALLED_SENT = "analyticsPluginInstalledSent"; |
| 49 | + public static final String FILTER_CRITICAL = "FILTER_SNYK_CRITICAL"; |
| 50 | + public static final String FILTER_HIGH = "FILTER_SNYK_HIGH"; |
| 51 | + public static final String FILTER_MEDIUM = "FILTER_SNYK_MEDIUM"; |
| 52 | + public static final String FILTER_LOW = "FILTER_SNYK_LOW"; |
49 | 53 |
|
50 | 54 | // This is a bit confusing - CLI takes DISABLE as env variable, but we ask for |
51 | 55 | // ENABLE, so we need to revert it |
@@ -74,6 +78,22 @@ public static synchronized Preferences getInstance(PreferenceStore store) { |
74 | 78 | if (getPref(ACTIVATE_SNYK_IAC) == null) { |
75 | 79 | store(ACTIVATE_SNYK_IAC, "true"); |
76 | 80 | } |
| 81 | + if (getPref(FILTER_CRITICAL) == null) { |
| 82 | + store(FILTER_CRITICAL, "false"); |
| 83 | + } |
| 84 | + if (getPref(FILTER_HIGH) == null) { |
| 85 | + store(FILTER_HIGH, "false"); |
| 86 | + } |
| 87 | + if (getPref(FILTER_MEDIUM) == null) { |
| 88 | + store(FILTER_MEDIUM, "false"); |
| 89 | + } |
| 90 | + if (getPref(FILTER_LOW) == null) { |
| 91 | + store(FILTER_LOW, "false"); |
| 92 | + } |
| 93 | + if (getPref(FILTER_CRITICAL) == null) { |
| 94 | + store(FILTER_CRITICAL, "false"); |
| 95 | + } |
| 96 | + |
77 | 97 | if (getPref(SEND_ERROR_REPORTS) == null) { |
78 | 98 | store(SEND_ERROR_REPORTS, "true"); |
79 | 99 | } |
@@ -133,7 +153,7 @@ public static synchronized Preferences getInstance(PreferenceStore store) { |
133 | 153 | if (deviceId == null || deviceId.isBlank()) { |
134 | 154 | store.put(DEVICE_ID, UUID.randomUUID().toString()); |
135 | 155 | } |
136 | | - |
| 156 | + |
137 | 157 | String releaseChannel = getPref(RELEASE_CHANNEL); |
138 | 158 | if (releaseChannel == null || releaseChannel.isBlank()) { |
139 | 159 | store.put(RELEASE_CHANNEL, "stable"); |
@@ -212,7 +232,7 @@ public String getReleaseChannel() { |
212 | 232 | public void setTest(boolean b) { |
213 | 233 | store.put("isTesting", Boolean.toString(b)); |
214 | 234 | } |
215 | | - |
| 235 | + |
216 | 236 | public boolean isTest() { |
217 | 237 | return getBooleanPref("isTesting"); |
218 | 238 | } |
|
0 commit comments