diff --git a/README.md b/README.md index 95aa82f..3c047d5 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.10.zip). +1. Download and install plugin from [Download Link](https://plugins.zhile.io/files/ide-eval-resetter-2.1.11.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 90677f3..3dd337b 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group 'io.zhile.research.intellij' -version '2.1.10' +version '2.1.11' sourceCompatibility = 1.7 targetCompatibility = 1.7 @@ -29,6 +29,8 @@ intellij { patchPluginXml { changeNotes """
+Release v2.1.11 + 1. fix for block list: https://plugins.jetbrains.com/files/brokenPlugins.json Release v2.1.10 1. update welcome menu for 2020.3.1 Release v2.1.9 diff --git a/src/main/java/io/zhile/research/intellij/ier/action/ResetAction.java b/src/main/java/io/zhile/research/intellij/ier/action/ResetAction.java index bd70f64..61493a8 100644 --- a/src/main/java/io/zhile/research/intellij/ier/action/ResetAction.java +++ b/src/main/java/io/zhile/research/intellij/ier/action/ResetAction.java @@ -12,10 +12,7 @@ import com.intellij.openapi.wm.ToolWindowAnchor; import com.intellij.openapi.wm.ToolWindowEP; import com.intellij.openapi.wm.ToolWindowManager; import com.intellij.openapi.wm.ex.ToolWindowManagerEx; -import io.zhile.research.intellij.ier.helper.Constants; -import io.zhile.research.intellij.ier.helper.CustomRepository; -import io.zhile.research.intellij.ier.helper.NotificationHelper; -import io.zhile.research.intellij.ier.helper.PluginHelper; +import io.zhile.research.intellij.ier.helper.*; import io.zhile.research.intellij.ier.listener.AppActivationListener; import io.zhile.research.intellij.ier.listener.AppEventListener; import io.zhile.research.intellij.ier.tw.MainToolWindowFactory; @@ -26,6 +23,11 @@ public class ResetAction extends AnAction implements DumbAware { static { AppEventListener.getInstance().listen(); AppActivationListener.getInstance().listen(); + try { + CustomProperties.checkAndUpdate(); + } catch (Exception e) { + NotificationHelper.showError(null, "Set broken plugins failed!"); + } CustomRepository.checkAndAdd(CustomRepository.DEFAULT_HOST); } diff --git a/src/main/java/io/zhile/research/intellij/ier/helper/CustomProperties.java b/src/main/java/io/zhile/research/intellij/ier/helper/CustomProperties.java new file mode 100644 index 0000000..665311f --- /dev/null +++ b/src/main/java/io/zhile/research/intellij/ier/helper/CustomProperties.java @@ -0,0 +1,46 @@ +package io.zhile.research.intellij.ier.helper; + +import com.intellij.openapi.application.PathManager; +import com.intellij.util.SystemProperties; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +public class CustomProperties { + public static void checkAndUpdate() throws Exception { + String key = "idea.ignore.disabled.plugins", value = "true"; + System.setProperty(key, value); + + Listpaths = new ArrayList<>(); + paths.add(Paths.get(SystemProperties.getUserHome(), PathManager.PROPERTIES_FILE_NAME)); + + String customOptionsDir = PathManager.getCustomOptionsDirectory(); + if (null != customOptionsDir) { + paths.add(Paths.get(customOptionsDir, PathManager.PROPERTIES_FILE_NAME)); + } + + for (Path path : paths) { + File file = path.toFile(); + if (!file.exists()) { + new FileOutputStream(file).close(); + } + + Properties props = new Properties(); + try (FileInputStream fis = new FileInputStream(file)) { + props.load(fis); + } + + props.setProperty(key, value); + + try (FileOutputStream fos = new FileOutputStream(file)) { + props.store(fos, null); + } + } + } +}