Signed-off-by: pengzhile <pengzhile@gmail.com>
pull/8/head
pengzhile 2021-01-19 18:54:43 +08:00
parent d064971423
commit dee34a27f9
4 changed files with 56 additions and 6 deletions

View File

@ -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`

View File

@ -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 """<pre>
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

View File

@ -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);
}

View File

@ -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);
List<Path> paths = 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);
}
}
}
}