Ticket #4035: better-bugreport.patch

File better-bugreport.patch, 4.9 KB (added by avarab@…, 16 years ago)

Patch to make the backtrace dialog awesomer

  • src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java

     
    2222import org.openstreetmap.josm.actions.ShowStatusReportAction;
    2323import org.openstreetmap.josm.plugins.PluginHandler;
    2424
     25import java.net.URL;
     26import java.net.URLEncoder;
     27import org.openstreetmap.josm.tools.UrlLabel;
     28
    2529/**
    2630 * An exception handler that asks the user to send a bug report.
    2731 *
     
    6468                    String text = ShowStatusReportAction.getReportHeader()
    6569                    + stack.getBuffer().toString();
    6670
     71                    URL url = new URL("http://josm.openstreetmap.de/newticket?" +
     72                                      // To note that it came from this code
     73                                      "keywords=template_report&" +
     74                                      "description=" + java.net.URLEncoder.encode(
     75                                                         // Note: This doesn't use tr() intentionally, we want bug reports in English
     76                                                         "What steps will reproduce the problem?\n"
     77                                                            + " 1. \n"
     78                                                            + " 2. \n"
     79                                                            + " 3. \n"
     80                                                            + "\n"
     81                                                            + "What is the expected result?\n\n"
     82                                                            + "What happens instead?\n\n"
     83                                                            + "Please provide any additional information below. Attach a screenshot if\n"
     84                                                            + "possible.\n\n"
     85                                                            + "{{{\n" + text + "\n}}}\n",
     86                                                         "UTF-8"));
     87
    6788                    JPanel p = new JPanel(new GridBagLayout());
    68                     p.add(new JLabel("<html>" + tr("Please report a ticket at {0}","http://josm.openstreetmap.de/newticket") +
    69                             "<br>" + tr("Include your steps to get to the error (as detailed as possible)!") +
    70                             "<br>" + tr("Try updating to the newest version of JOSM and all plugins before reporting a bug.") +
    71                             "<br>" + tr("Be sure to include the following information:") + "</html>"), GBC.eol());
     89                    p.add(new JLabel(tr("<html>" +
     90                                        "<p>You've encountered an error in JOSM. Before you file a bug<br>" +
     91                                        "make sure you've updated to the latest version of JOSM here:</p></html>")), GBC.eol());
     92                    p.add(new UrlLabel("http://josm.openstreetmap.de/#Download"), GBC.eop().insets(8,0,0,0));
     93                    p.add(new JLabel(tr("<html>You should also update your plugins. If neither of those help please<br>" +
     94                                        "file a bug in our bugtracker using this link:</p></html>")), GBC.eol());
     95                    p.add(new UrlLabel(url.toString(), "http://josm.openstreetmap.de/newticket?..."), GBC.eop().insets(8,0,0,0));
     96                    p.add(new JLabel(tr("<html><p>" +
     97                                        "There the the error information provided below should already be<br>" +
     98                                        "filled out for you. Please include information on how to reproduce<br>" +
     99                                        "the error and try to supply as much detail as possible.</p></html>")), GBC.eop());
     100                    p.add(new JLabel(tr("<html><p>" +
     101                                        "Alternatively if that doesn't work you can manually fill in the information<br>" +
     102                                        "below at this URL:</p></html>")), GBC.eol());
     103                    p.add(new UrlLabel("http://josm.openstreetmap.de/newticket"), GBC.eop().insets(8,0,0,0));
    72104                    try {
    73105                        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(text), new ClipboardOwner(){
    74106                            public void lostOwnership(Clipboard clipboard, Transferable contents) {}
     
    82114                    info.setEditable(false);
    83115                    p.add(new JScrollPane(info), GBC.eop());
    84116
    85                     JOptionPane.showMessageDialog(Main.parent, p, tr("Warning"), JOptionPane.WARNING_MESSAGE);
     117                    JOptionPane.showMessageDialog(Main.parent, p, tr("You've encountered a bug in JOSM"), JOptionPane.ERROR_MESSAGE);
    86118                } catch (Exception e1) {
    87119                    e1.printStackTrace();
    88120                }