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 classBugReportQueue.BugReportDisplayRunnablestatic interfaceBugReportQueue.BugReportHandlerClass that handles reporting a bug to the user.static classBugReportQueue.SuppressionModeThe suppression mode that should be used after the dialog was closed.
-
Field Summary
Fields Modifier and Type Field Description private BugReportQueue.BugReportHandlerbugReportHandlerprivate intdisplayedErrorsprivate java.lang.ThreaddisplayThreadstatic BugReportQueue.BugReportHandlerFALLBACK_BUGREPORT_HANDLERThe fallback bug report handler if none is set.private java.util.concurrent.CopyOnWriteArrayList<java.util.function.Predicate<ReportedException>>handlersprivate booleaninReportDialogprivate static BugReportQueueINSTANCEprivate java.util.LinkedList<ReportedException>reportsToDisplayprivate booleansuppressAllMessagesprivate 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 voidaddBugReportHandler(java.util.function.Predicate<ReportedException> handler)Allows you to peek or even intercept the bug reports.private BugReportQueue.SuppressionModedisplayFor(ReportedException e)booleanexceptionHandlingInProgress()Check if the dialog is shown.private intgetDisplayedErrors()static BugReportQueuegetInstance()Gets the global bug report queueprivate ReportedExceptiongetNext()private voidhandleDialogResult(ReportedException e, BugReportQueue.SuppressionMode suppress)voidsetBugReportHandler(BugReportQueue.BugReportHandler bugReportHandler)Sets theBugReportQueue.BugReportHandlerfor this queue.voidsubmit(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:
trueif the exception handler is still showing the exception to the user.
-
setBugReportHandler
public void setBugReportHandler(BugReportQueue.BugReportHandler bugReportHandler)
Sets theBugReportQueue.BugReportHandlerfor 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
-
-