Changeset 14176 in josm


Ignore:
Timestamp:
2018-08-22T01:20:19+02:00 (8 months ago)
Author:
Don-vip
Message:

see #16666 - extract DefaultBugReportSendingHandler to its own class in order to control AWT loading. Having it defined as a public static field of BugReportDialog class makes Java load AWT way too early.

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

Legend:

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

    r14154 r14176  
    106106import org.openstreetmap.josm.gui.SplashScreen.SplashProgressMonitor;
    107107import org.openstreetmap.josm.gui.bugreport.BugReportDialog;
     108import org.openstreetmap.josm.gui.bugreport.DefaultBugReportSendingHandler;
    108109import org.openstreetmap.josm.gui.download.DownloadDialog;
    109110import org.openstreetmap.josm.gui.io.CredentialDialog;
     
    776777        if (!GraphicsEnvironment.isHeadless()) {
    777778            BugReportQueue.getInstance().setBugReportHandler(BugReportDialog::showFor);
    778             BugReportSender.setBugReportSendingHandler(BugReportDialog.bugReportSendingHandler);
     779            BugReportSender.setBugReportSendingHandler(new DefaultBugReportSendingHandler());
    779780        }
    780781
  • trunk/src/org/openstreetmap/josm/gui/bugreport/BugReportDialog.java

    r14153 r14176  
    1818import javax.swing.JOptionPane;
    1919import javax.swing.JPanel;
    20 import javax.swing.SwingUtilities;
    2120import javax.swing.UIManager;
    2221
     
    3332import org.openstreetmap.josm.tools.ImageProvider;
    3433import org.openstreetmap.josm.tools.InputMapUtils;
    35 import org.openstreetmap.josm.tools.OpenBrowser;
    3634import org.openstreetmap.josm.tools.bugreport.BugReport;
    3735import org.openstreetmap.josm.tools.bugreport.BugReportQueue.SuppressionMode;
    3836import org.openstreetmap.josm.tools.bugreport.BugReportSender;
    39 import org.openstreetmap.josm.tools.bugreport.BugReportSender.BugReportSendingHandler;
    4037import org.openstreetmap.josm.tools.bugreport.ReportedException;
    4138
     
    5552    private JCheckBox cbSuppressSingle;
    5653    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(Config.getUrls().getJOSMWebsite() + "/newticket", 2), GBC.eop().insets(8, 0, 0, 0));
    77                 errorPanel.add(new DebugTextDisplay(statusText));
    78 
    79                 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), errorPanel, tr("You have encountered a bug in JOSM"),
    80                         JOptionPane.ERROR_MESSAGE);
    81             });
    82         }
    83     };
    8454
    8555    /**
Note: See TracChangeset for help on using the changeset viewer.