Changeset 5849 in josm
- Timestamp:
- 2013-04-14T00:05:26+02:00 (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AboutAction.java
r5797 r5849 5 5 6 6 import java.awt.Dimension; 7 import java.awt.Font;8 7 import java.awt.GridBagLayout; 9 8 import java.awt.event.ActionEvent; … … 22 21 import org.openstreetmap.josm.gui.util.GuiHelper; 23 22 import org.openstreetmap.josm.plugins.PluginHandler; 23 import org.openstreetmap.josm.tools.BugReportExceptionHandler; 24 24 import org.openstreetmap.josm.tools.GBC; 25 25 import org.openstreetmap.josm.tools.ImageProvider; 26 26 import org.openstreetmap.josm.tools.Shortcut; 27 27 import org.openstreetmap.josm.tools.UrlLabel; 28 import org.openstreetmap.josm.tools.Utils; 28 29 29 30 /** … … 83 84 info.add(GBC.glue(0,5), GBC.eol()); 84 85 info.add(new JLabel(tr("Bug Reports")), GBC.std().insets(10,0,10,0)); 85 info.add( new UrlLabel("http://josm.openstreetmap.de/newticket",2), GBC.eol().fill(GBC.HORIZONTAL));86 info.add(BugReportExceptionHandler.getBugReportUrlLabel(Utils.strip(ShowStatusReportAction.getReportHeader())), GBC.eol().fill(GBC.HORIZONTAL)); 86 87 87 88 about.addTab(tr("Info"), info); -
trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
r5840 r5849 28 28 import org.openstreetmap.josm.gui.ExtendedDialog; 29 29 import org.openstreetmap.josm.plugins.PluginHandler; 30 import org.openstreetmap.josm.tools.BugReportExceptionHandler; 31 import org.openstreetmap.josm.tools.OpenBrowser; 30 32 import org.openstreetmap.josm.tools.Shortcut; 31 33 import org.openstreetmap.josm.tools.Utils; … … 113 115 public void actionPerformed(ActionEvent e) { 114 116 StringBuilder text = new StringBuilder(); 115 text.append(getReportHeader()); 117 String reportHeader = getReportHeader(); 118 text.append(reportHeader); 116 119 try { 117 120 Map<String, Setting> settings = Main.pref.getAllSettings(); … … 141 144 ExtendedDialog ed = new ExtendedDialog(Main.parent, 142 145 tr("Status Report"), 143 new String[] {tr("Copy to clipboard and close"), tr(" Close") });144 ed.setButtonIcons(new String[] {"copy.png", " cancel.png" });146 new String[] {tr("Copy to clipboard and close"), tr("Report bug"), tr("Close") }); 147 ed.setButtonIcons(new String[] {"copy.png", "bug.png", "cancel.png" }); 145 148 ed.setContent(sp, false); 146 149 ed.setMinimumSize(new Dimension(380, 200)); 147 150 ed.setPreferredSize(new Dimension(700, Main.parent.getHeight()-50)); 148 151 149 if (ed.showDialog().getValue() != 1) return; 150 Utils.copyToClipboard(text.toString()); 152 switch (ed.showDialog().getValue()) { 153 case 1: Utils.copyToClipboard(text.toString()); break; 154 case 2: OpenBrowser.displayUrl(BugReportExceptionHandler.getBugReportUrl( 155 Utils.strip(reportHeader)).toExternalForm()) ; break; 156 } 151 157 } 152 158 } -
trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java
r5827 r5849 7 7 import java.awt.GridBagLayout; 8 8 import java.io.ByteArrayOutputStream; 9 import java.io.IOException; 9 10 import java.io.PrintWriter; 10 11 import java.io.StringWriter; … … 121 122 } 122 123 123 ByteArrayOutputStream out = new ByteArrayOutputStream();124 GZIPOutputStream gzip = new GZIPOutputStream(out);125 gzip.write(urltext.getBytes("UTF-8"));126 gzip.close();127 128 URL url = new URL("http://josm.openstreetmap.de/josmticket?" +129 "gdata="+Base64.encode(ByteBuffer.wrap(out.toByteArray()), true));130 131 124 JPanel p = new JPanel(new GridBagLayout()); 132 125 p.add(new JMultilineLabel( … … 137 130 tr("You should also update your plugins. If neither of those help please " + 138 131 "file a bug report in our bugtracker using this link:")), GBC.eol()); 139 p.add( new UrlLabel(url.toString(), "http://josm.openstreetmap.de/josmticket?...",2), GBC.eop().insets(8,0,0,0));132 p.add(getBugReportUrlLabel(urltext), GBC.eop().insets(8,0,0,0)); 140 133 p.add(new JMultilineLabel( 141 134 tr("There the error information provided below should already be " + … … 175 168 return handlingInProgress; 176 169 } 170 171 /** 172 * Replies the URL to create a JOSM bug report with the given debug text 173 * @param debugText The debug text to provide us 174 * @return The URL to create a JOSM bug report with the given debug text 175 * @since 5849 176 */ 177 public static URL getBugReportUrl(String debugText) { 178 try { 179 ByteArrayOutputStream out = new ByteArrayOutputStream(); 180 GZIPOutputStream gzip = new GZIPOutputStream(out); 181 gzip.write(debugText.getBytes("UTF-8")); 182 gzip.close(); 183 184 return new URL("http://josm.openstreetmap.de/josmticket?" + 185 "gdata="+Base64.encode(ByteBuffer.wrap(out.toByteArray()), true)); 186 } catch (IOException e) { 187 e.printStackTrace(); 188 return null; 189 } 190 } 191 192 /** 193 * Replies the URL label to create a JOSM bug report with the given debug text 194 * @param debugText The debug text to provide us 195 * @return The URL label to create a JOSM bug report with the given debug text 196 * @since 5849 197 */ 198 public static final UrlLabel getBugReportUrlLabel(String debugText) { 199 URL url = getBugReportUrl(debugText); 200 if (url != null) { 201 return new UrlLabel(url.toString(), "http://josm.openstreetmap.de/josmticket?...", 2); 202 } 203 return null; 204 } 177 205 }
Note:
See TracChangeset
for help on using the changeset viewer.