2014-08-21 19:46:16 +02:00
|
|
|
package processing.app.helpers;
|
|
|
|
|
|
|
|
import static processing.app.I18n._;
|
|
|
|
|
2014-08-21 20:23:53 +02:00
|
|
|
public class BasicUserNotifier extends UserNotifier {
|
2014-08-21 19:46:16 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Show an error message that's actually fatal to the program.
|
|
|
|
* This is an error that can't be recovered. Use showWarning()
|
|
|
|
* for errors that allow P5 to continue running.
|
|
|
|
*/
|
|
|
|
public void showError(String title, String message, Throwable e, int exit_code) {
|
|
|
|
if (title == null) title = _("Error");
|
|
|
|
|
|
|
|
System.err.println(title + ": " + message);
|
|
|
|
|
|
|
|
if (e != null) e.printStackTrace();
|
|
|
|
System.exit(exit_code);
|
|
|
|
}
|
|
|
|
|
2014-08-21 19:55:50 +02:00
|
|
|
public void showMessage(String title, String message) {
|
|
|
|
if (title == null) title = _("Message");
|
|
|
|
|
|
|
|
System.out.println(title + ": " + message);
|
|
|
|
}
|
|
|
|
|
2014-08-21 20:23:53 +02:00
|
|
|
/**
|
|
|
|
* Non-fatal error message with optional stack trace side dish.
|
|
|
|
*/
|
|
|
|
public void showWarning(String title, String message, Exception e) {
|
|
|
|
if (title == null) title = _("Warning");
|
|
|
|
|
|
|
|
System.out.println(title + ": " + message);
|
|
|
|
|
|
|
|
if (e != null) e.printStackTrace();
|
|
|
|
}
|
|
|
|
|
2014-08-21 19:46:16 +02:00
|
|
|
}
|