- Timestamp:
- 2010-01-09T00:50:20+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java
r2721 r2784 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Component; 6 7 import java.awt.GridBagLayout; 7 8 import java.awt.Toolkit; … … 12 13 import java.io.PrintWriter; 13 14 import java.io.StringWriter; 15 import java.net.URL; 14 16 15 17 import javax.swing.JLabel; … … 21 23 import org.openstreetmap.josm.Main; 22 24 import org.openstreetmap.josm.actions.ShowStatusReportAction; 25 import org.openstreetmap.josm.gui.JMultilineLabel; 23 26 import org.openstreetmap.josm.plugins.PluginHandler; 24 import org.openstreetmap.josm.tools.Base64;25 26 import java.net.URL;27 import java.net.URLEncoder;28 import org.openstreetmap.josm.tools.UrlLabel;29 27 30 28 /** … … 47 45 "where ### is the number of MB assigned to JOSM (e.g. 256).\n" + 48 46 "Currently, " + Runtime.getRuntime().maxMemory()/1024/1024 + " MB are available to JOSM.", 49 tr("Error"),47 "Error", 50 48 JOptionPane.ERROR_MESSAGE 51 49 ); … … 73 71 if(urltext.length() > maxlen) 74 72 { 75 urltext = urltext.substring(0,maxlen); 76 int idx = urltext.lastIndexOf("\n"); 77 /* cut whole line when not loosing too much */ 78 if(maxlen-idx < 200) 79 urltext = urltext.substring(0,idx+1); 80 urltext += "...<snip>...\n"; 73 urltext = urltext.substring(0,maxlen); 74 int idx = urltext.lastIndexOf("\n"); 75 /* cut whole line when not loosing too much */ 76 if(maxlen-idx < 200) { 77 urltext = urltext.substring(0,idx+1); 78 } 79 urltext += "...<snip>...\n"; 81 80 } 82 81 83 82 URL url = new URL("http://josm.openstreetmap.de/josmticket?" + 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 83 "data="+ 84 Base64.encode( 85 // To note that it came from this code 86 "keywords=template_report&" + 87 "description=" + java.net.URLEncoder.encode( 88 // Note: This doesn't use tr() intentionally, we want bug reports in English 89 "What steps will reproduce the problem?\n" 90 + " 1. \n" 91 + " 2. \n" 92 + " 3. \n" 93 + "\n" 94 + "What is the expected result?\n\n" 95 + "What happens instead?\n\n" 96 + "Please provide any additional information below. Attach a screenshot if\n" 97 + "possible.\n\n" 98 + "{{{\n" + urltext + "\n}}}\n", 99 "UTF-8"))); 101 100 102 101 JPanel p = new JPanel(new GridBagLayout()); 103 p.add(new J Label(tr("<html>" +104 "<p>You've encountered an error in JOSM. Before you file a bug<br>" +105 "make sure you've updated to the latest version of JOSM here:</p></html>")), GBC.eol());102 p.add(new JMultilineLabel( 103 tr("You have encountered an error in JOSM. Before you file a bug report" + 104 "make sure you have updated to the latest version of JOSM here:")), GBC.eol()); 106 105 p.add(new UrlLabel("http://josm.openstreetmap.de/#Download"), GBC.eop().insets(8,0,0,0)); 107 p.add(new JLabel(tr("<html>You should also update your plugins. If neither of those help please<br>" + 108 "file a bug in our bugtracker using this link:</p></html>")), GBC.eol()); 106 p.add(new JMultilineLabel( 107 tr("You should also update your plugins. If neither of those help please" + 108 "file a bug report in our bugtracker using this link:")), GBC.eol()); 109 109 p.add(new UrlLabel(url.toString(), "http://josm.openstreetmap.de/josmticket?..."), GBC.eop().insets(8,0,0,0)); 110 p.add(new J Label(tr("<html><p>" +111 "There the error information provided below should already be<br>" +112 "filled out for you. Please include information on how to reproduce<br>" +113 "the error and try to supply as much detail as possible.</p></html>")), GBC.eop());114 p.add(new J Label(tr("<html><p>" +115 "Alternatively if that doesn't work you can manually fill in the information<br>" +116 "below at this URL:</p></html>")), GBC.eol());110 p.add(new JMultilineLabel( 111 tr("There the error information provided below should already be" + 112 "filled in for you. Please include information on how to reproduce" + 113 "the error and try to supply as much detail as possible.")), GBC.eop()); 114 p.add(new JMultilineLabel( 115 tr("Alternatively, if that doesn't work you can manually fill in the information" + 116 "below at this URL:")), GBC.eol()); 117 117 p.add(new UrlLabel("http://josm.openstreetmap.de/newticket"), GBC.eop().insets(8,0,0,0)); 118 118 try { … … 129 129 p.add(new JScrollPane(info), GBC.eop()); 130 130 131 JOptionPane.showMessageDialog(Main.parent, p, tr("You've encountered a bug in JOSM"), JOptionPane.ERROR_MESSAGE); 131 for (Component c: p.getComponents()) { 132 if (c instanceof JMultilineLabel) { 133 ((JMultilineLabel)c).setMaxWidth(400); 134 } 135 } 136 137 JOptionPane.showMessageDialog(Main.parent, p, tr("You have encountered a bug in JOSM"), JOptionPane.ERROR_MESSAGE); 132 138 } catch (Exception e1) { 133 139 e1.printStackTrace();
Note:
See TracChangeset
for help on using the changeset viewer.