fixed gitee issue: I4EVTS
parent
f5d61c4b99
commit
a517a441f6
|
@ -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.4-62e7c8.zip).
|
||||
1. Download and install plugin from [Download Link](https://plugins.zhile.io/files/ide-eval-resetter-2.3.5-c80a1d.zip).
|
||||
* Alternative installation method:
|
||||
* Add "Custom Plugin Repository": `https://plugins.zhile.io` manually (`Settings/Preferences` -> `Plugins`)
|
||||
* Search and install plugin: `IDE Eval Reset`
|
||||
|
|
|
@ -4,7 +4,7 @@ plugins {
|
|||
}
|
||||
|
||||
group 'io.zhile.research.intellij'
|
||||
version '2.3.4'
|
||||
version '2.3.5'
|
||||
|
||||
sourceCompatibility = 1.7
|
||||
targetCompatibility = 1.7
|
||||
|
@ -29,6 +29,8 @@ intellij {
|
|||
|
||||
patchPluginXml {
|
||||
changeNotes = """<pre>
|
||||
Release v2.3.4
|
||||
1. fixed gitee issue: I4EVTS
|
||||
Release v2.3.4
|
||||
1. update the logic of auto reset option
|
||||
Release v2.3.3
|
||||
|
|
|
@ -45,7 +45,12 @@ public class ListenerConnector {
|
|||
}
|
||||
|
||||
private static void callPluginInstallListenerMethod(String methodName) { // reflection for old versions
|
||||
String className = ListenerConnector.class.getPackage().getName() + ".PluginListener";
|
||||
Class<?> klass = ReflectionHelper.getClass("com.intellij.ide.plugins.PluginStateListener");
|
||||
if (null == klass) {
|
||||
return;
|
||||
}
|
||||
|
||||
String className = ListenerConnector.class.getPackage().getName() + ".PluginInstallListener";
|
||||
Method method = ReflectionHelper.getMethod(className, methodName);
|
||||
if (null == method) {
|
||||
return;
|
||||
|
@ -54,7 +59,7 @@ public class ListenerConnector {
|
|||
try {
|
||||
method.invoke(null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package io.zhile.research.intellij.ier.listener;
|
||||
|
||||
import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
||||
import com.intellij.ide.plugins.PluginInstaller;
|
||||
import com.intellij.ide.plugins.PluginStateListener;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import io.zhile.research.intellij.ier.common.Resetter;
|
||||
import io.zhile.research.intellij.ier.helper.ReflectionHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class PluginInstallListener implements PluginStateListener {
|
||||
private static final PluginStateListener stateListener = new PluginInstallListener();
|
||||
|
||||
private static void reflectionCall(String methodName) throws Exception {
|
||||
Method[] methods = new Method[]{
|
||||
ReflectionHelper.getMethod(PluginInstaller.class, methodName, PluginStateListener.class),
|
||||
ReflectionHelper.getMethod("com.intellij.ide.plugins.PluginStateManager", methodName, PluginStateListener.class),
|
||||
};
|
||||
|
||||
for (Method method : methods) {
|
||||
if (null == method) {
|
||||
continue;
|
||||
}
|
||||
|
||||
method.invoke(null, stateListener);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setup() throws Exception {
|
||||
reflectionCall("addStateListener");
|
||||
}
|
||||
|
||||
public static void remove() throws Exception {
|
||||
reflectionCall("removeStateListener");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void install(@NotNull final IdeaPluginDescriptor descriptor) {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Resetter.addPluginLicense(descriptor);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstall(@NotNull IdeaPluginDescriptor descriptor) {
|
||||
|
||||
}
|
||||
}
|
|
@ -2,12 +2,9 @@ package io.zhile.research.intellij.ier.listener;
|
|||
|
||||
import com.intellij.ide.plugins.DynamicPluginListener;
|
||||
import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
||||
import com.intellij.ide.plugins.PluginStateListener;
|
||||
import com.intellij.ide.plugins.PluginStateManager;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import io.zhile.research.intellij.ier.common.Resetter;
|
||||
import io.zhile.research.intellij.ier.helper.Constants;
|
||||
import io.zhile.research.intellij.ier.helper.NotificationHelper;
|
||||
|
@ -16,32 +13,7 @@ import io.zhile.research.intellij.ier.helper.ResetTimeHelper;
|
|||
import io.zhile.research.intellij.ier.tw.MainToolWindowFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PluginListener implements DynamicPluginListener, PluginStateListener {
|
||||
private static final PluginStateListener stateListener = new PluginListener();
|
||||
|
||||
public static void setup() {
|
||||
PluginStateManager.addStateListener(stateListener);
|
||||
}
|
||||
|
||||
public static void remove() {
|
||||
PluginStateManager.removeStateListener(stateListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void install(@NotNull final IdeaPluginDescriptor descriptor) {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Resetter.addPluginLicense(descriptor);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstall(@NotNull IdeaPluginDescriptor descriptor) {
|
||||
|
||||
}
|
||||
|
||||
public class PluginListener implements DynamicPluginListener {
|
||||
@Override
|
||||
public void pluginLoaded(@NotNull IdeaPluginDescriptor descriptor) {
|
||||
if (!PluginHelper.myself(descriptor)) {
|
||||
|
|
Loading…
Reference in New Issue