From 58ad4fbda802182e4e82dcb4611e18df414535ae Mon Sep 17 00:00:00 2001 From: pengzhile Date: Wed, 18 Nov 2020 12:17:43 +0800 Subject: [PATCH] fix the pop-up of license window Signed-off-by: pengzhile --- README.md | 2 +- build.gradle | 4 +++- .../intellij/ier/common/Resetter.java | 20 +++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e1fe6fb..a8961ca 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Reset Your IDE Eval Information -1. Download and install plugin from [Download Link](https://plugins.zhile.io/files/ide-eval-resetter-2.1.5.zip). +1. Download and install plugin from [Download Link](https://plugins.zhile.io/files/ide-eval-resetter-2.1.6.zip). * Alternative installation method: * Add "Custom Plugin Repository": `https://plugins.zhile.io` manually (`Settings/Preferences` -> `Plugins`) * Search and install plugin: `IDE Eval Reset` diff --git a/build.gradle b/build.gradle index 9a059f0..31b5436 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group 'io.zhile.research.intellij' -version '2.1.5' +version '2.1.6' sourceCompatibility = 1.7 targetCompatibility = 1.7 @@ -29,6 +29,8 @@ intellij { patchPluginXml { changeNotes """
+Release v2.1.6
+  1. fix the pop-up of license window
 Release v2.1.5
   1. fix memory leak
 Release v2.1.4
diff --git a/src/main/java/io/zhile/research/intellij/ier/common/Resetter.java b/src/main/java/io/zhile/research/intellij/ier/common/Resetter.java
index 451e006..845959b 100644
--- a/src/main/java/io/zhile/research/intellij/ier/common/Resetter.java
+++ b/src/main/java/io/zhile/research/intellij/ier/common/Resetter.java
@@ -47,6 +47,22 @@ public class Resetter {
             }
         }
 
+        File licenseDir = getLicenseDir();
+        if (licenseDir.exists()) {
+            File[] files = licenseDir.listFiles();
+            if (files == null) {
+                NotificationHelper.showError(null, "List license file failed!");
+            } else {
+                for (File file : files) {
+                    if (!file.getName().endsWith(".key") && !file.getName().endsWith(".license")) {
+                        continue;
+                    }
+
+                    list.add(new NormalFileRecord(file));
+                }
+            }
+        }
+
         Element state = PropertyRecord.PROPS.getState();
         if (state != null) {
             Attribute attrName, attrValue;
@@ -171,6 +187,10 @@ public class Resetter {
         return new File(configPath, "eval");
     }
 
+    protected static File getLicenseDir() {
+        return new File(PathManager.getConfigPath());
+    }
+
     protected static void getAllPrefsKeys(Preferences prefs, List list) throws BackingStoreException {
         String[] childrenNames = prefs.childrenNames();
         if (childrenNames.length == 0) {