mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ITNReporter: check whether parent component of message dialog is showing
This commit is contained in:
@@ -43,6 +43,7 @@ import com.intellij.util.Consumer;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.HyperlinkEvent;
|
||||
import java.awt.*;
|
||||
|
||||
@@ -68,7 +69,7 @@ public class ITNReporter extends ErrorReportSubmitter {
|
||||
String additionalInfo,
|
||||
Component parentComponent,
|
||||
Consumer<SubmittedReportInfo> consumer) {
|
||||
return sendError(events [0], additionalInfo, parentComponent, consumer);
|
||||
return sendError(events[0], additionalInfo, parentComponent, consumer);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,11 +195,10 @@ public class ITNReporter extends ErrorReportSubmitter {
|
||||
ApplicationInfoEx appInfo = (ApplicationInfoEx) ApplicationManager.getApplication().getComponent(ApplicationInfo.class);
|
||||
String message = DiagnosticBundle.message(
|
||||
appInfo.isEAP() ? "error.report.new.eap.build.message" : "error.report.new.build.message", e.getMessage());
|
||||
Messages.showMessageDialog(parentComponent, message, CommonBundle.getWarningTitle(), Messages.getWarningIcon());
|
||||
showMessageDialog(parentComponent, project, message, CommonBundle.getWarningTitle(), Messages.getWarningIcon());
|
||||
callback.consume(new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED));
|
||||
}
|
||||
else if (Messages.showYesNoDialog(parentComponent, msg,
|
||||
ReportMessages.ERROR_REPORT, Messages.getErrorIcon()) != 0) {
|
||||
else if (showYesNoDialog(parentComponent, project, msg, ReportMessages.ERROR_REPORT, Messages.getErrorIcon()) != 0) {
|
||||
callback.consume(new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED));
|
||||
}
|
||||
else {
|
||||
@@ -225,4 +225,20 @@ public class ITNReporter extends ErrorReportSubmitter {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void showMessageDialog(Component parentComponent, Project project, String message, String title, Icon icon) {
|
||||
if (parentComponent.isShowing()) {
|
||||
Messages.showMessageDialog(parentComponent, message, title, icon);
|
||||
} else {
|
||||
Messages.showMessageDialog(project, message, title, icon);
|
||||
}
|
||||
}
|
||||
|
||||
private static int showYesNoDialog(Component parentComponent, Project project, String message, String title, Icon icon) {
|
||||
if (parentComponent.isShowing()) {
|
||||
return Messages.showYesNoDialog(parentComponent, message, title, icon);
|
||||
} else {
|
||||
return Messages.showYesNoDialog(project, message, title, icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user