diff --git a/.gitignore b/.gitignore index 573e847..ec794a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store .idea/ .gradle/ build/ diff --git a/build.gradle b/build.gradle index 63c0a96..34bef97 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group 'io.zhile.research.intellij' -version '1.0.4' +version '1.0.5' repositories { mavenCentral() @@ -19,12 +19,14 @@ intellij { // localPath "${System.properties['user.home']}/Applications/IntelliJ IDEA.app" // alternativeIdePath localPath - version "2020.1.2" + version "2020.2.3" type "IU" } patchPluginXml { changeNotes """ + release v1.0.5 + 1. update for 2020.2.x release v1.0.4 1. reset completely release v1.0.3 diff --git a/reset_eval/reset_jetbrains_eval_mac_linux.sh b/reset_eval/reset_jetbrains_eval_mac_linux.sh index 7eb7ff0..d6d8b58 100755 --- a/reset_eval/reset_jetbrains_eval_mac_linux.sh +++ b/reset_eval/reset_jetbrains_eval_mac_linux.sh @@ -1,5 +1,5 @@ #!/bin/bash -# reset jetbrains ide evals v1.0.4 +# reset jetbrains ide evals v1.0.5 OS_NAME=$(uname -s) JB_PRODUCTS="IntelliJIdea CLion PhpStorm GoLand PyCharm WebStorm Rider DataGrip RubyMine AppCode" diff --git a/reset_eval/reset_jetbrains_eval_windows.vbs b/reset_eval/reset_jetbrains_eval_windows.vbs index 28b1cb6..b743b5a 100644 --- a/reset_eval/reset_jetbrains_eval_windows.vbs +++ b/reset_eval/reset_jetbrains_eval_windows.vbs @@ -1,4 +1,4 @@ -' reset jetbrains ide evals v1.0.4 +' reset jetbrains ide evals v1.0.5 Set oShell = CreateObject("WScript.Shell") Set oFS = CreateObject("Scripting.FileSystemObject") sHomeFolder = oShell.ExpandEnvironmentStrings("%USERPROFILE%") @@ -53,9 +53,10 @@ On Error Resume Next oShell.RegDelete "HKEY_CURRENT_USER\Software\JavaSoft\Prefs\/Jet/Brains./User/Id/On/Machine" oShell.RegDelete "HKEY_CURRENT_USER\Software\JavaSoft\Prefs\jetbrains\device_id" oShell.RegDelete "HKEY_CURRENT_USER\Software\JavaSoft\Prefs\jetbrains\user_id_on_machine" +oShell.RegDelete "HKEY_CURRENT_USER\Software\JavaSoft\Prefs\jetbrains\" oFs.DeleteFile sJBDataFolder + "\bl" oFs.DeleteFile sJBDataFolder + "\crl" oFs.DeleteFile sJBDataFolder + "\PermanentUserId" oFs.DeleteFile sJBDataFolder + "\PermanentDeviceId" -MsgBox "done" \ No newline at end of file +MsgBox "done" diff --git a/src/main/java/io/zhile/research/intellij/action/ResetAction.java b/src/main/java/io/zhile/research/intellij/action/ResetAction.java index d0c1c63..c37757f 100644 --- a/src/main/java/io/zhile/research/intellij/action/ResetAction.java +++ b/src/main/java/io/zhile/research/intellij/action/ResetAction.java @@ -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); + } + } }