Ignore:
Timestamp:
2017-09-08T21:10:14+02:00 (7 years ago)
Author:
Don-vip
Message:

see #15229 - see #15182 - remove GUI references from BugReportSender

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r12777 r12790  
    149149import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler;
    150150import org.openstreetmap.josm.tools.bugreport.BugReportQueue;
     151import org.openstreetmap.josm.tools.bugreport.BugReportSender;
    151152import org.xml.sax.SAXException;
    152153
     
    778779        if (!GraphicsEnvironment.isHeadless()) {
    779780            BugReportQueue.getInstance().setBugReportHandler(BugReportDialog::showFor);
     781            BugReportSender.setBugReportSendingHandler(BugReportDialog.bugReportSendingHandler);
    780782        }
    781783
  • trunk/src/org/openstreetmap/josm/gui/bugreport/BugReportDialog.java

    r12649 r12790  
    1919import javax.swing.JOptionPane;
    2020import javax.swing.JPanel;
     21import javax.swing.SwingUtilities;
    2122import javax.swing.UIManager;
    2223
     
    3233import org.openstreetmap.josm.tools.ImageProvider;
    3334import org.openstreetmap.josm.tools.InputMapUtils;
     35import org.openstreetmap.josm.tools.OpenBrowser;
    3436import org.openstreetmap.josm.tools.bugreport.BugReport;
    3537import org.openstreetmap.josm.tools.bugreport.BugReportQueue.SuppressionMode;
    3638import org.openstreetmap.josm.tools.bugreport.BugReportSender;
     39import org.openstreetmap.josm.tools.bugreport.BugReportSender.BugReportSendingHandler;
    3740import org.openstreetmap.josm.tools.bugreport.ReportedException;
    3841
     
    5255    private JCheckBox cbSuppressSingle;
    5356    private JCheckBox cbSuppressAll;
     57
     58    /**
     59     * Default bug report callback that opens the bug report form in user browser
     60     * and displays a dialog in case of error.
     61     * @since 12790
     62     */
     63    public static final BugReportSendingHandler bugReportSendingHandler = new BugReportSendingHandler() {
     64        @Override
     65        public String sendingBugReport(String bugUrl, String statusText) {
     66            return OpenBrowser.displayUrl(bugUrl);
     67        }
     68
     69        @Override
     70        public void failed(String errorMessage, String statusText) {
     71            SwingUtilities.invokeLater(() -> {
     72                JPanel errorPanel = new JPanel(new GridBagLayout());
     73                errorPanel.add(new JMultilineLabel(
     74                        tr("Opening the bug report failed. Please report manually using this website:")),
     75                        GBC.eol().fill(GridBagConstraints.HORIZONTAL));
     76                errorPanel.add(new UrlLabel(Main.getJOSMWebsite() + "/newticket", 2), GBC.eop().insets(8, 0, 0, 0));
     77                errorPanel.add(new DebugTextDisplay(statusText));
     78
     79                JOptionPane.showMessageDialog(Main.parent, errorPanel, tr("You have encountered a bug in JOSM"),
     80                        JOptionPane.ERROR_MESSAGE);
     81            });
     82        }
     83    };
    5484
    5585    /**
Note: See TracChangeset for help on using the changeset viewer.