update for 2020.2.x

Signed-off-by: pengzhile <pengzhile@gmail.com>
This commit is contained in:
pengzhile
2020-10-13 17:15:29 +08:00
parent 65e19f94b7
commit 945d63e4ea
5 changed files with 34 additions and 5 deletions
@@ -20,6 +20,7 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Scanner;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
public class ResetAction extends AnAction {
@@ -73,6 +74,13 @@ public class ResetAction extends AnAction {
prefs.remove(NEW_MACHINE_ID_KEY);
prefs.remove(DEVICE_ID_KEY);
try {
removeEvalNode(prefs);
} catch (BackingStoreException e) {
NotificationHelper.showError(project, "Remove evlsprt failed!");
return;
}
Preferences.userRoot().node(Constants.PLUGIN_NAME).put(Constants.PRODUCT_NAME + Constants.PRODUCT_HASH, Long.toString(System.currentTimeMillis()));
if (appInfo.isVendorJetBrains() && SystemInfo.isWindows) {
@@ -118,4 +126,21 @@ public class ResetAction extends AnAction {
return new File(new File(configPath, "options"), "other.xml");
}
protected void removeEvalNode(Preferences prefs) throws BackingStoreException {
String[] keys = prefs.childrenNames();
if (keys.length == 0) {
return;
}
for (String key : keys) {
Preferences node = prefs.node(key);
if (key.startsWith("evlsprt")) {
node.removeNode();
continue;
}
removeEvalNode(node);
}
}
}