+
+ /**
+ * Display an error message and log it.
+ *
+ * @param message
+ * the message
+ * @param title
+ * the title of the error message
+ */
+ private void error(String message, String title) {
+ error(message, title, null);
+ }
+
+ /**
+ * Display an error message and log it, including the linked
+ * {@link Exception}.
+ *
+ * @param message
+ * the message
+ * @param title
+ * the title of the error message
+ * @param e
+ * the exception to log if any (can be NULL)
+ */
+ private void error(String message, String title, Exception e) {
+ Instance.getTraceHandler().error(title + ": " + message);
+ if (e != null) {
+ Instance.getTraceHandler().error(e);
+ }
+
+ if (e != null) {
+ messageBox(title, message //
+ + "\n" + e.getMessage());
+ } else {
+ messageBox(title, message);
+ }
+ }
+
+ /**
+ * Ask the user and, if confirmed, close the {@link TApplication} this
+ * {@link TWidget} is running on.
+ * <p>
+ * This should result in the program terminating.
+ *
+ * @param widget
+ * the {@link TWidget}
+ */
+ static public void close(TWidget widget) {
+ close(widget.getApplication());
+ }
+
+ /**
+ * Ask the user and, if confirmed, close the {@link TApplication}.
+ * <p>
+ * This should result in the program terminating.
+ *
+ * @param app
+ * the {@link TApplication}
+ */
+ static void close(TApplication app) {
+ // TODO: i18n
+ if (app.messageBox("Confirmation", "(TODO: i18n) Exit application?",
+ TMessageBox.Type.YESNO).getResult() == TMessageBox.Result.YES) {
+ app.exit();
+ }
+ }