MCPcopy Index your code
hub / github.com/processing/processing / showTrace

Method showTrace

app/src/processing/app/Messages.java:158–186  ·  view source on GitHub ↗

Testing a new warning window that includes the stack trace.

(String title, String message,
                               Throwable t, boolean fatal)

Source from the content-addressed store, hash-verified

156 * Testing a new warning window that includes the stack trace.
157 */
158 static public void showTrace(String title, String message,
159 Throwable t, boolean fatal) {
160 if (title == null) title = fatal ? "Error" : "Warning";
161
162 if (Base.isCommandLine()) {
163 System.err.println(title + ": " + message);
164 if (t != null) {
165 t.printStackTrace();
166 }
167
168 } else {
169 StringWriter sw = new StringWriter();
170 t.printStackTrace(new PrintWriter(sw));
171 // Necessary to replace \n with <br/> (even if pre) otherwise Java
172 // treats it as a closed tag and reverts to plain formatting.
173 message = ("<html>" + message +
174 "<br/><font size=2><br/>" +
175 sw + "</html>").replaceAll("\n", "<br/>");
176
177 JOptionPane.showMessageDialog(new Frame(), message, title,
178 fatal ?
179 JOptionPane.ERROR_MESSAGE :
180 JOptionPane.WARNING_MESSAGE);
181
182 if (fatal) {
183 System.exit(1);
184 }
185 }
186 }
187
188
189 // ...................................................................

Callers 5

runMethod · 0.95
createAndShowGUIMethod · 0.95
handleOpenMethod · 0.95
getSettingsFolderMethod · 0.95
getLibCMethod · 0.95

Calls 5

isCommandLineMethod · 0.95
exitMethod · 0.80
printlnMethod · 0.45
printStackTraceMethod · 0.45
replaceAllMethod · 0.45

Tested by

no test coverage detected