GP-65 - Error Dialog - updated the error dialog to accumulate errors

while it is open instead of repeatedly showing new dialogs
This commit is contained in:
dragonmacher 2020-08-20 17:37:44 -04:00
parent 4506acddf9
commit fc247aa499
44 changed files with 1784 additions and 1662 deletions

View file

@ -225,33 +225,6 @@ public class Msg {
}
}
/**
* Used to display a warning message to the user with a pop-up GUI dialog.
* Also records the message to the logging system.
*
* @param originator
* a Logger instance, "this", or YourClass.class
* @param parent
* a parent component used to center the dialog (or null if you
* don't have one)
* @param title
* the title of the pop-up dialog (main subject of message)
* @param message
* the details of the message
* @param throwable
* the Throwable that describes the cause of the warning
*/
public static void showWarn(Object originator, Component parent, String title, Object message,
Throwable throwable) {
if (SystemUtilities.isInHeadlessMode()) {
Msg.warn(originator, message, throwable);
}
else {
errorDisplay.displayWarningMessage(errorLogger, originator, parent, title, message,
throwable);
}
}
/**
* Used to display an error message with no available Throwable to the user
* via the console (no GUI). Also records the message to the logging system.

View file

@ -499,14 +499,31 @@ public class ReflectionUtilities {
* @return the string
*/
public static String stackTraceToString(Throwable t) {
StringBuffer sb = new StringBuffer();
return stackTraceToString(t.getMessage(), t);
}
/**
* Turns the given {@link Throwable} into a String version of its
* {@link Throwable#printStackTrace()} method.
*
* @param message the preferred message to use. If null, the throwable message will be used
* @param t the throwable
* @return the string
*/
public static String stackTraceToString(String message, Throwable t) {
StringBuilder sb = new StringBuilder();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
String msg = t.getMessage();
if (msg != null) {
ps.println(msg);
if (message != null) {
ps.println(message);
}
else {
String throwableMessage = t.getMessage();
if (throwableMessage != null) {
ps.println(throwableMessage);
}
}
t.printStackTrace(ps);