Class BugReportQueue
- java.lang.Object
-
- org.openstreetmap.josm.tools.bugreport.BugReportQueue
-
public class BugReportQueue extends java.lang.Object
This class handles the display of the bug report dialog.- Since:
- 10819
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
BugReportQueue.BugReportDisplayRunnable
static interface
BugReportQueue.BugReportHandler
Class that handles reporting a bug to the user.static class
BugReportQueue.SuppressionMode
The suppression mode that should be used after the dialog was closed.
-
Field Summary
Fields Modifier and Type Field Description private BugReportQueue.BugReportHandler
bugReportHandler
private int
displayedErrors
private java.lang.Thread
displayThread
static BugReportQueue.BugReportHandler
FALLBACK_BUGREPORT_HANDLER
The fallback bug report handler if none is set.private java.util.concurrent.CopyOnWriteArrayList<java.util.function.Predicate<ReportedException>>
handlers
private boolean
inReportDialog
private static BugReportQueue
INSTANCE
private java.util.LinkedList<ReportedException>
reportsToDisplay
private boolean
suppressAllMessages
private java.util.ArrayList<ReportedException>
suppressFor
-
Constructor Summary
Constructors Constructor Description BugReportQueue()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBugReportHandler(java.util.function.Predicate<ReportedException> handler)
Allows you to peek or even intercept the bug reports.private BugReportQueue.SuppressionMode
displayFor(ReportedException e)
boolean
exceptionHandlingInProgress()
Check if the dialog is shown.private int
getDisplayedErrors()
static BugReportQueue
getInstance()
Gets the global bug report queueprivate ReportedException
getNext()
private void
handleDialogResult(ReportedException e, BugReportQueue.SuppressionMode suppress)
void
setBugReportHandler(BugReportQueue.BugReportHandler bugReportHandler)
Sets theBugReportQueue.BugReportHandler
for this queue.void
submit(ReportedException report)
Submit a new error to be displayed
-
-
-
Field Detail
-
FALLBACK_BUGREPORT_HANDLER
public static final BugReportQueue.BugReportHandler FALLBACK_BUGREPORT_HANDLER
The fallback bug report handler if none is set. Prints the stacktrace on standard error stream.- Since:
- 12770
-
INSTANCE
private static final BugReportQueue INSTANCE
-
reportsToDisplay
private final java.util.LinkedList<ReportedException> reportsToDisplay
-
suppressAllMessages
private boolean suppressAllMessages
-
suppressFor
private final java.util.ArrayList<ReportedException> suppressFor
-
displayThread
private java.lang.Thread displayThread
-
bugReportHandler
private BugReportQueue.BugReportHandler bugReportHandler
-
handlers
private final java.util.concurrent.CopyOnWriteArrayList<java.util.function.Predicate<ReportedException>> handlers
-
displayedErrors
private int displayedErrors
-
inReportDialog
private boolean inReportDialog
-
-
Constructor Detail
-
BugReportQueue
public BugReportQueue()
-
-
Method Detail
-
submit
public void submit(ReportedException report)
Submit a new error to be displayed- Parameters:
report
- The error to display
-
handleDialogResult
private void handleDialogResult(ReportedException e, BugReportQueue.SuppressionMode suppress)
-
getNext
private ReportedException getNext() throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
displayFor
private BugReportQueue.SuppressionMode displayFor(ReportedException e)
-
getDisplayedErrors
private int getDisplayedErrors()
-
exceptionHandlingInProgress
public boolean exceptionHandlingInProgress()
Check if the dialog is shown. Should only be used for e.g. debugging.- Returns:
true
if the exception handler is still showing the exception to the user.
-
setBugReportHandler
public void setBugReportHandler(BugReportQueue.BugReportHandler bugReportHandler)
Sets theBugReportQueue.BugReportHandler
for this queue.- Parameters:
bugReportHandler
- the handler in charge of displaying the bug report. Must not be null- Since:
- 12770
-
addBugReportHandler
public void addBugReportHandler(java.util.function.Predicate<ReportedException> handler)
Allows you to peek or even intercept the bug reports.- Parameters:
handler
- The handler. It can return false to stop all further handling of the exception.- Since:
- 10886
-
getInstance
public static BugReportQueue getInstance()
Gets the global bug report queue- Returns:
- The queue
- Since:
- 10886
-
-