Warning window that includes the stack trace.
(String title, String message,
Throwable t, boolean fatal)
| 121 | * Warning window that includes the stack trace. |
| 122 | */ |
| 123 | static public void showTrace(String title, String message, |
| 124 | Throwable t, boolean fatal) { |
| 125 | if (title == null) title = fatal ? "Error" : "Warning"; |
| 126 | |
| 127 | if (Base.isCommandLine()) { |
| 128 | System.err.println(title + ": " + message); |
| 129 | if (t != null) { |
| 130 | t.printStackTrace(); |
| 131 | } |
| 132 | |
| 133 | } else { |
| 134 | StringWriter sw = new StringWriter(); |
| 135 | t.printStackTrace(new PrintWriter(sw)); |
| 136 | |
| 137 | JOptionPane.showMessageDialog(new Frame(), |
| 138 | // first <br/> clears to the next line |
| 139 | // second <br/> is a shorter height blank space before the trace |
| 140 | Toolkit.formatMessage(message + "<br/><tt><br/>" + sw + "</tt>"), |
| 141 | title, |
| 142 | fatal ? |
| 143 | JOptionPane.ERROR_MESSAGE : |
| 144 | JOptionPane.WARNING_MESSAGE); |
| 145 | |
| 146 | if (fatal) { |
| 147 | System.exit(1); |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | |
| 153 | static public int showYesNoQuestion(Frame editor, String title, |
no test coverage detected