use of com.att.aro.core.util.CrashHandler in project VideoOptimzer by attdevsupport.
the class AROFileMenu method handlePrint.
private void handlePrint() {
final JComponent currentTabComponent = (JComponent) parent.getCurrentTabComponent();
if (currentTabComponent instanceof IAROPrintable) {
final IAROPrintable aroPrintable = (IAROPrintable) currentTabComponent;
final PrinterJob printJob = PrinterJob.getPrinterJob();
if (printJob.printDialog()) {
new Thread(new Runnable() {
@Override
public void run() {
Thread.setDefaultUncaughtExceptionHandler(new CrashHandler());
printJob.setPrintable(new AROPrintablePanel(aroPrintable.getPrintablePanel()));
try {
printJob.print();
} catch (PrinterException e) {
String[] messageWrapper = new String[1];
messageWrapper[0] = e.getLocalizedMessage();
new MessageDialogFactory().showErrorDialog(null, tabPanelCommon.getText(MenuItem.error_printer, messageWrapper));
}
}
}).start();
}
} else {
throw new AROUIIllegalStateException(tabPanelCommon.getText(MenuItem.error_printer_notprintable));
}
}
use of com.att.aro.core.util.CrashHandler in project VideoOptimzer by attdevsupport.
the class DataDump method startBackgroundWorker.
/**
* Initialize and start background worker thread to create datadump file
* @param traceFolders
*/
private void startBackgroundWorker(final List<File> traceFolders) {
SwingWorker<File, Object> datadumpWorker = new SwingWorker<File, Object>() {
@Override
protected File doInBackground() throws IOException, ProfileException {
Thread.setDefaultUncaughtExceptionHandler(new CrashHandler());
startDataDump(traceFolders);
return fileToSave;
}
@Override
protected void done() {
try {
if (get().getName().contains(EXTENSION_FILTER)) {
if (singleTrace) {
LOG.info(ResourceBundleHelper.getMessageString(MessageItem.table_export_success));
} else {
if (new MessageDialogFactory().showExportConfirmDialog(MSG_WINDOW) == JOptionPane.YES_OPTION) {
Desktop desktop = Desktop.getDesktop();
desktop.open(get());
}
}
}
this.cancel(true);
} catch (IOException e) {
LOG.error("Unexpected IOException analyzing trace", e);
new MessageDialogFactory().showUnexpectedExceptionDialog(MSG_WINDOW, e);
} catch (UnsupportedOperationException unsupportedException) {
MessageDialogFactory.showMessageDialog(MSG_WINDOW, ResourceBundleHelper.getMessageString(MessageItem.Error_unableToOpen));
} catch (InterruptedException e) {
LOG.error("Unexpected exception analyzing trace", e);
new MessageDialogFactory().showUnexpectedExceptionDialog(MSG_WINDOW, e);
} catch (ExecutionException e) {
LOG.error("Unexpected execution exception analyzing trace", e);
if (e.getCause() instanceof OutOfMemoryError) {
new MessageDialogFactory().showErrorDialog(null, ResourceBundleHelper.getMessageString(MessageItem.Error_outOfMemory));
} else {
new MessageDialogFactory().showUnexpectedExceptionDialog(MSG_WINDOW, e);
}
}
}
};
datadumpWorker.execute();
}
Aggregations