add custom error handler
parent
b3dfb382c9
commit
359d2ef4b6
|
@ -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.2.2-940eb7.zip).
|
||||
1. Download and install plugin from [Download Link](https://plugins.zhile.io/files/ide-eval-resetter-2.2.3-031813.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.2.2'
|
||||
version '2.2.3'
|
||||
|
||||
sourceCompatibility = 1.7
|
||||
targetCompatibility = 1.7
|
||||
|
@ -29,6 +29,8 @@ intellij {
|
|||
|
||||
patchPluginXml {
|
||||
changeNotes = """<pre>
|
||||
Release v2.2.3
|
||||
1. add custom error handler
|
||||
Release v2.2.2
|
||||
1. fix issue with JRebel
|
||||
Release v2.2.1
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package io.zhile.research.intellij.ier.helper;
|
||||
|
||||
import com.intellij.openapi.diagnostic.ErrorReportSubmitter;
|
||||
import com.intellij.openapi.diagnostic.IdeaLoggingEvent;
|
||||
import com.intellij.openapi.diagnostic.SubmittedReportInfo;
|
||||
import com.intellij.util.Consumer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.net.URI;
|
||||
|
||||
public class ErrorReporter extends ErrorReportSubmitter {
|
||||
private static final String NEW_ISSUE_URL = "https://gitee.com/pengzhile/ide-eval-resetter/issues/new";
|
||||
|
||||
public String getReportActionText() {
|
||||
return "Open Browser to Submit This Issue...";
|
||||
}
|
||||
|
||||
public String getPrivacyNoticeText() {
|
||||
return "Click the submit button will <b>write the stacktrace text to your clipboard</b>!<br>So that you can paste it directly when writing the issue.";
|
||||
}
|
||||
|
||||
public boolean submit(IdeaLoggingEvent[] events, String additionalInfo, @NotNull Component parentComponent, @NotNull Consumer consumer) {
|
||||
int length = events.length - 1;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i <= length; i++) {
|
||||
sb.append(events[i].getThrowableText());
|
||||
if (i != length) { // f**k java7
|
||||
sb.append("\n\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI(NEW_ISSUE_URL));
|
||||
StringSelection selection = new StringSelection(sb.toString());
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection);
|
||||
|
||||
consumer.consume(new SubmittedReportInfo(SubmittedReportInfo.SubmissionStatus.NEW_ISSUE));
|
||||
} catch (Exception e) {
|
||||
consumer.consume(new SubmittedReportInfo(SubmittedReportInfo.SubmissionStatus.FAILED));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -2,25 +2,25 @@ package io.zhile.research.intellij.ier.listener;
|
|||
|
||||
import com.intellij.ide.AppLifecycleListener;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import io.zhile.research.intellij.ier.helper.Constants;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AppInitListener implements AppLifecycleListener {
|
||||
public void appFrameCreated(String[] commandLineArgs, @NotNull Ref<Boolean> willOpenProject) {
|
||||
|
||||
}
|
||||
|
||||
public void appFrameCreated(@NotNull List<String> commandLineArgs) {
|
||||
ActionManager.getInstance().getAction(Constants.RESET_ACTION_ID);
|
||||
}
|
||||
|
||||
public void appStarting(@Nullable Project projectFromCommandLine) {
|
||||
|
||||
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ActionManager.getInstance().getAction(Constants.RESET_ACTION_ID);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void projectFrameClosed() {
|
||||
|
|
|
@ -29,4 +29,8 @@
|
|||
<listener class="io.zhile.research.intellij.ier.listener.AppInitListener"
|
||||
topic="com.intellij.ide.AppLifecycleListener"/>
|
||||
</applicationListeners>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<errorHandler implementation="io.zhile.research.intellij.ier.helper.ErrorReporter"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
Loading…
Reference in New Issue