Changeset 10064 in josm for trunk/src/org
- Timestamp:
- 2016-03-28T02:57:02+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandler.java
r10062 r10064 35 35 * 36 36 * @author imi 37 * @since 40 37 38 */ 38 39 public final class BugReportExceptionHandler implements Thread.UncaughtExceptionHandler { … … 183 184 private static void askForBugReport(final Throwable e) { 184 185 try { 185 StringWriter stack = new StringWriter(); 186 e.printStackTrace(new PrintWriter(stack)); 187 188 String text = ShowStatusReportAction.getReportHeader() + stack.getBuffer().toString(); 189 text = text.replaceAll("\r", ""); 190 191 JPanel p = new JPanel(new GridBagLayout()); 192 p.add(new JMultilineLabel( 193 tr("You have encountered an error in JOSM. Before you file a bug report " + 194 "make sure you have updated to the latest version of JOSM here:")), 195 GBC.eol().fill(GridBagConstraints.HORIZONTAL)); 196 p.add(new UrlLabel(Main.getJOSMWebsite(), 2), GBC.eop().insets(8, 0, 0, 0)); 197 p.add(new JMultilineLabel( 198 tr("You should also update your plugins. If neither of those help please " + 199 "file a bug report in our bugtracker using this link:")), 200 GBC.eol().fill(GridBagConstraints.HORIZONTAL)); 201 p.add(new JButton(new ReportBugAction(text)), GBC.eop().insets(8, 0, 0, 0)); 202 p.add(new JMultilineLabel( 203 tr("There the error information provided below should already be " + 204 "filled in for you. Please include information on how to reproduce " + 205 "the error and try to supply as much detail as possible.")), 206 GBC.eop().fill(GridBagConstraints.HORIZONTAL)); 207 p.add(new JMultilineLabel( 208 tr("Alternatively, if that does not work you can manually fill in the information " + 209 "below at this URL:")), GBC.eol().fill(GridBagConstraints.HORIZONTAL)); 210 p.add(new UrlLabel(Main.getJOSMWebsite()+"/newticket", 2), GBC.eop().insets(8, 0, 0, 0)); 211 212 // Wiki formatting for manual copy-paste 213 DebugTextDisplay textarea = new DebugTextDisplay(text); 214 215 if (textarea.copyToClippboard()) { 216 p.add(new JLabel(tr("(The text has already been copied to your clipboard.)")), 217 GBC.eop().fill(GridBagConstraints.HORIZONTAL)); 218 } 219 220 p.add(textarea, GBC.eop().fill()); 221 222 for (Component c: p.getComponents()) { 223 if (c instanceof JMultilineLabel) { 224 ((JMultilineLabel) c).setMaxWidth(400); 225 } 226 } 227 186 JPanel p = buildPanel(e); 228 187 JOptionPane.showMessageDialog(Main.parent, p, tr("You have encountered a bug in JOSM"), JOptionPane.ERROR_MESSAGE); 229 188 } catch (Exception e1) { 230 189 Main.error(e1); 231 190 } 191 } 192 193 static JPanel buildPanel(final Throwable e) { 194 StringWriter stack = new StringWriter(); 195 e.printStackTrace(new PrintWriter(stack)); 196 197 String text = ShowStatusReportAction.getReportHeader() + stack.getBuffer().toString(); 198 text = text.replaceAll("\r", ""); 199 200 JPanel p = new JPanel(new GridBagLayout()); 201 p.add(new JMultilineLabel( 202 tr("You have encountered an error in JOSM. Before you file a bug report " + 203 "make sure you have updated to the latest version of JOSM here:")), 204 GBC.eol().fill(GridBagConstraints.HORIZONTAL)); 205 p.add(new UrlLabel(Main.getJOSMWebsite(), 2), GBC.eop().insets(8, 0, 0, 0)); 206 p.add(new JMultilineLabel( 207 tr("You should also update your plugins. If neither of those help please " + 208 "file a bug report in our bugtracker using this link:")), 209 GBC.eol().fill(GridBagConstraints.HORIZONTAL)); 210 p.add(new JButton(new ReportBugAction(text)), GBC.eop().insets(8, 0, 0, 0)); 211 p.add(new JMultilineLabel( 212 tr("There the error information provided below should already be " + 213 "filled in for you. Please include information on how to reproduce " + 214 "the error and try to supply as much detail as possible.")), 215 GBC.eop().fill(GridBagConstraints.HORIZONTAL)); 216 p.add(new JMultilineLabel( 217 tr("Alternatively, if that does not work you can manually fill in the information " + 218 "below at this URL:")), GBC.eol().fill(GridBagConstraints.HORIZONTAL)); 219 p.add(new UrlLabel(Main.getJOSMWebsite()+"/newticket", 2), GBC.eop().insets(8, 0, 0, 0)); 220 221 // Wiki formatting for manual copy-paste 222 DebugTextDisplay textarea = new DebugTextDisplay(text); 223 224 if (textarea.copyToClippboard()) { 225 p.add(new JLabel(tr("(The text has already been copied to your clipboard.)")), 226 GBC.eop().fill(GridBagConstraints.HORIZONTAL)); 227 } 228 229 p.add(textarea, GBC.eop().fill()); 230 231 for (Component c: p.getComponents()) { 232 if (c instanceof JMultilineLabel) { 233 ((JMultilineLabel) c).setMaxWidth(400); 234 } 235 } 236 return p; 232 237 } 233 238
Note:
See TracChangeset
for help on using the changeset viewer.