/** * An error has occurred which we did not expect or did not know how to handle. The user is * alerted and given the option to send us feedback. * * @param title * @param message * @param details */ public void showUnhandledErrorDialog( String title, String message, String details, Throwable cause) { Logger.getLogger(Application.class).error(message, cause); // This is where I should insert the request as to whether or not to mail an error try { String lastExceptionUUID = PreferencesManager.getPreferences(Application.class).get("errorMailer.last", ""); String currentExceptionUUID = Util.getStackTraceUUID(cause); if (!lastExceptionUUID.equals(currentExceptionUUID)) { boolean sent = ErrorMailer.sendError(title, message, cause); if (sent) { PreferencesManager.getPreferences(Application.class) .put("errorMailer.last", currentExceptionUUID); PreferencesManager.getPreferences(Application.class).flush(); } } } catch (Exception e) { e.printStackTrace(); details += "\n\nAnd an Exception while trying to mail the error.\n" + Util.getStackTraceString(e); } ErrorDialog dialog = details.length() > 0 ? new ErrorDialog(message, details) : new ErrorDialog(message); JOptionPane.showMessageDialog( getProjectExplorer(), dialog, title, JOptionPane.ERROR_MESSAGE, UIResourceManager.getIcon(UIResourceManager.ICON_ERROR)); }
/** TODO: refactor this, perhaps into the Platform class, or maybe into Application */ public static String getKorsakowHome() { final String home; switch (Platform.getOS()) { case MAC: home = Util.join( Arrays.asList( Application.getUserHome(), "Library", "Application Support", "Korsakow"), File.separator); break; case WIN: home = Util.join(Arrays.asList(System.getenv("AppData"), "Korsakow"), File.separator); break; default: case NIX: home = Util.join(Arrays.asList(getUserHome(), ".korsakow"), File.separator); break; } return home; }
public void showUnhandledErrorDialog(String title, String message, Throwable details) { showUnhandledErrorDialog(title, message, Util.getStackTraceString(details), details); }
public DefaultTableWidgetPropertiesEditor(WidgetModel widget) { this(Util.list(WidgetModel.class, widget)); }