diff --git a/README.md b/README.md index 8784742..2c50d4a 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.3.1-6b4c51.zip). +1. Download and install plugin from [Download Link](https://plugins.zhile.io/files/ide-eval-resetter-2.3.2-10863c.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 30b25e7..752d865 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group 'io.zhile.research.intellij' -version '2.3.1' +version '2.3.2' sourceCompatibility = 1.7 targetCompatibility = 1.7 @@ -29,6 +29,8 @@ intellij { patchPluginXml { changeNotes = """
+Release v2.3.2
+  1. fix plugin version
 Release v2.3.1
   1. fix for some plugins
 Release v2.3.0
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 837c3b0..77bc26c 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
@@ -7,10 +7,7 @@ import com.intellij.ide.util.PropertiesComponent;
 import com.intellij.ide.util.PropertiesComponentImpl;
 import com.intellij.openapi.application.PathManager;
 import com.intellij.openapi.util.SystemInfo;
-import io.zhile.research.intellij.ier.helper.AppHelper;
-import io.zhile.research.intellij.ier.helper.Constants;
-import io.zhile.research.intellij.ier.helper.NotificationHelper;
-import io.zhile.research.intellij.ier.helper.ReflectionHelper;
+import io.zhile.research.intellij.ier.helper.*;
 import io.zhile.research.intellij.ier.plugins.MyBatisCodeHelper;
 import org.jdom.Attribute;
 import org.jdom.Element;
@@ -18,10 +15,7 @@ import org.jdom.Element;
 import java.io.File;
 import java.lang.reflect.Method;
 import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.*;
 import java.util.prefs.BackingStoreException;
 import java.util.prefs.Preferences;
 
@@ -34,7 +28,7 @@ public class Resetter {
     private static final String AUTO_RESET_KEY = Constants.PLUGIN_PREFS_PREFIX + ".auto_reset." + Constants.IDE_NAME_LOWER + "." + Constants.IDE_HASH;
 
     private static final Method METHOD_GET_PRODUCT_CODE = ReflectionHelper.getMethod(IdeaPluginDescriptor.class, "getProductCode");
-    private static final Method METHOD_GET_RELEASE_VERSION = ReflectionHelper.getMethod(IdeaPluginDescriptor.class, "getReleaseVersion");
+    private static final Method METHOD_GET_RELEASE_DATE = ReflectionHelper.getMethod(IdeaPluginDescriptor.class, "getReleaseDate");
     private static final Set LICENSE_FILES = new TreeSet<>();
 
     public static List getEvalRecords() {
@@ -163,7 +157,7 @@ public class Resetter {
 
     public static void touchLicenses() {
         try {
-            if (null == METHOD_GET_PRODUCT_CODE || null == METHOD_GET_RELEASE_VERSION) {
+            if (null == METHOD_GET_PRODUCT_CODE || null == METHOD_GET_RELEASE_DATE) {
                 return;
             }
 
@@ -192,18 +186,18 @@ public class Resetter {
     }
 
     public static void addPluginLicense(IdeaPluginDescriptor descriptor) {
-        if (null == METHOD_GET_PRODUCT_CODE || null == METHOD_GET_RELEASE_VERSION) {
+        if (null == METHOD_GET_PRODUCT_CODE || null == METHOD_GET_RELEASE_DATE) {
             return;
         }
 
         try {
             String productCode = (String) METHOD_GET_PRODUCT_CODE.invoke(descriptor);
-            int releaseVersion = (int) METHOD_GET_RELEASE_VERSION.invoke(descriptor);
-            if (null == productCode || productCode.isEmpty() || 0 == releaseVersion) {
+            Date releaseDate = (Date) METHOD_GET_RELEASE_DATE.invoke(descriptor);
+            if (null == productCode || productCode.isEmpty() || null == releaseDate) {
                 return;
             }
 
-            LICENSE_FILES.add(String.format("plg_%s_%s.evaluation.key", productCode, releaseVersion));
+            LICENSE_FILES.add(String.format("plg_%s_%s.evaluation.key", productCode, DateTime.getPluginReleaseDateStr(releaseDate)));
         } catch (Exception e) {
             NotificationHelper.showError(null, "Add plugin eval license failed!");
         }
diff --git a/src/main/java/io/zhile/research/intellij/ier/helper/DateTime.java b/src/main/java/io/zhile/research/intellij/ier/helper/DateTime.java
index 0368c90..fec40a6 100644
--- a/src/main/java/io/zhile/research/intellij/ier/helper/DateTime.java
+++ b/src/main/java/io/zhile/research/intellij/ier/helper/DateTime.java
@@ -3,13 +3,19 @@ package io.zhile.research.intellij.ier.helper;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.Locale;
 
 public class DateTime {
     public static final DateFormat DF_DATETIME = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    public static final DateFormat DF_PLUGIN_DATE = new SimpleDateFormat("yyyyMMdd", Locale.US);
 
     public static String getStringFromTimestamp(long timestamp) {
         Date date = new Date(timestamp);
 
         return DF_DATETIME.format(date);
     }
+
+    public static String getPluginReleaseDateStr(Date releaseDate) {
+        return DF_PLUGIN_DATE.format(releaseDate);
+    }
 }
diff --git a/src/main/java/io/zhile/research/intellij/ier/ui/form/MainForm.java b/src/main/java/io/zhile/research/intellij/ier/ui/form/MainForm.java
index 231e68f..2ee8edb 100644
--- a/src/main/java/io/zhile/research/intellij/ier/ui/form/MainForm.java
+++ b/src/main/java/io/zhile/research/intellij/ier/ui/form/MainForm.java
@@ -121,6 +121,7 @@ public class MainForm {
     private void reloadRecordItems() {
         listModel.clear();
 
+        Resetter.touchLicenses();
         List recordItemList = Resetter.getEvalRecords();
         for (EvalRecord record : recordItemList) {
             listModel.addElement(record.toString());