parent
f145eac269
commit
2225971c59
|
@ -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.12.zip).
|
||||
1. Download and install plugin from [Download Link](https://plugins.zhile.io/files/ide-eval-resetter-2.1.13.zip).
|
||||
* Alternative installation method:
|
||||
* Add "Custom Plugin Repository": `https://plugins.zhile.io` manually (`Settings/Preferences` -> `Plugins`)
|
||||
* Search and install plugin: `IDE Eval Reset`
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'org.jetbrains.intellij' version '0.5.0'
|
||||
id 'org.jetbrains.intellij' version '0.6.5'
|
||||
}
|
||||
|
||||
group 'io.zhile.research.intellij'
|
||||
version '2.1.12'
|
||||
version '2.1.13'
|
||||
|
||||
sourceCompatibility = 1.7
|
||||
targetCompatibility = 1.7
|
||||
|
@ -29,6 +29,8 @@ intellij {
|
|||
|
||||
patchPluginXml {
|
||||
changeNotes """<pre>
|
||||
Release v2.1.13
|
||||
1. fix error notification
|
||||
Release v2.1.12
|
||||
1. fix disable plugins
|
||||
Release v2.1.11
|
||||
|
|
|
@ -22,16 +22,12 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class ResetAction extends AnAction implements DumbAware {
|
||||
static {
|
||||
CustomProperties.fix();
|
||||
BrokenPlugins.fix();
|
||||
BrokenPluginsListener.getInstance().listen();
|
||||
|
||||
AppEventListener.getInstance().listen();
|
||||
AppActivationListener.getInstance().listen();
|
||||
try {
|
||||
CustomProperties.fix();
|
||||
} catch (Exception e) {
|
||||
//
|
||||
}
|
||||
CustomRepository.checkAndAdd(CustomRepository.DEFAULT_HOST);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
package io.zhile.research.intellij.ier.helper;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
|
||||
public class BrokenPlugins {
|
||||
private static final Logger LOG = Logger.getInstance(BrokenPlugins.class);
|
||||
|
||||
public static void fix() {
|
||||
String content = "[]";
|
||||
String fileName = "brokenPlugins.json";
|
||||
|
@ -19,12 +21,17 @@ public class BrokenPlugins {
|
|||
return;
|
||||
}
|
||||
|
||||
File tmp = null;
|
||||
try {
|
||||
Path bak = brokenPluginsPath.getParent().resolve(fileName + ".tmp");
|
||||
Files.write(bak, content.getBytes());
|
||||
Files.move(bak, brokenPluginsPath, StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);
|
||||
tmp = File.createTempFile(fileName, null);
|
||||
FileUtil.writeToFile(tmp, content);
|
||||
FileUtil.copy(tmp, brokenPluginsFile);
|
||||
} catch (IOException e) {
|
||||
NotificationHelper.showError(null, "Set broken plugins failed!");
|
||||
LOG.warn("Set broken plugins failed", e);
|
||||
} finally {
|
||||
if (null != tmp) {
|
||||
FileUtil.delete(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,51 +1,8 @@
|
|||
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 fix() throws Exception {
|
||||
public static void fix() {
|
||||
String key = "idea.ignore.disabled.plugins";
|
||||
System.clearProperty(key);
|
||||
|
||||
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()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Properties props = new Properties();
|
||||
try (FileInputStream fis = new FileInputStream(file)) {
|
||||
props.load(fis);
|
||||
}
|
||||
|
||||
props.remove(key);
|
||||
|
||||
if (props.isEmpty()) {
|
||||
file.delete();
|
||||
continue;
|
||||
}
|
||||
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
props.store(fos, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue