Changeset 4607 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2011-11-23T20:31:30+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java
r4380 r4607 11 11 import java.nio.ByteBuffer; 12 12 13 import javax.swing.JCheckBox; 13 14 import javax.swing.JLabel; 14 15 import javax.swing.JOptionPane; … … 22 23 import org.openstreetmap.josm.plugins.PluginHandler; 23 24 25 import javax.swing.JPanel; 26 import org.openstreetmap.josm.gui.ExtendedDialog; 27 import org.openstreetmap.josm.tools.GBC; 28 import java.awt.GridBagLayout; 29 24 30 /** 25 31 * An exception handler that asks the user to send a bug report. … … 30 36 31 37 private static boolean handlingInProgress = false; 38 private static int exceptionCounter = 0; 39 private static boolean suppressExceptionDialogs = false; 32 40 33 41 public void uncaughtException(Thread t, Throwable e) { … … 43 51 if (handlingInProgress) 44 52 return; // we do not handle secondary exceptions, this gets too messy 53 if (suppressExceptionDialogs) 54 return; 45 55 handlingInProgress = true; 56 exceptionCounter++; 46 57 try { 47 58 e.printStackTrace(); … … 66 77 // Then ask for submitting a bug report, for exceptions thrown from a plugin too 67 78 // 68 Object[] options = new String[]{tr("Do nothing"), tr("Report Bug")}; 69 int answer = JOptionPane.showOptionDialog( 70 Main.parent, 79 ExtendedDialog ed = new ExtendedDialog(Main.parent, tr("Unexpected Exception"), new String[] {tr("Do nothing"), tr("Report Bug")}); 80 ed.setIcon(JOptionPane.ERROR_MESSAGE); 81 JPanel pnl = new JPanel(new GridBagLayout()); 82 pnl.add(new JLabel( 71 83 "<html>" 72 84 + tr("An unexpected exception occurred.<br>" + … … 74 86 "version of JOSM, please consider being kind and file a bug report." 75 87 ) 76 + "</html>", 77 tr("Unexpected Exception"), 78 JOptionPane.YES_NO_OPTION, 79 JOptionPane.ERROR_MESSAGE, 80 null, 81 options, options[0] 82 ); 83 if (answer != 1) return; 84 88 + "</html>"), GBC.eol()); 89 JCheckBox cbSuppress = null; 90 if (exceptionCounter > 1) { 91 cbSuppress = new JCheckBox(tr("Suppress further error dialogs for this session.")); 92 pnl.add(cbSuppress, GBC.eol()); 93 } 94 ed.setContent(pnl); 95 ed.showDialog(); 96 if (cbSuppress != null && cbSuppress.isSelected()) { 97 suppressExceptionDialogs = true; 98 } 99 if (ed.getValue() != 2) return; 100 85 101 try { 86 102 final int maxlen = 6000;
Note:
See TracChangeset
for help on using the changeset viewer.