<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>In our application, we currently install an uncaught exception handler which will show a dialog.</div>

<div>This dialog contains the exception stracktrace and a button with the possibility to mail it.</div>

<div>Unfortunately, if an exception occurs in the layout phase (pulse), trying to show a dialog will result in an exception as we can't start a nested event loop in this situation.</div>

<div>This is because <em>Dialog.showAndWait()</em> checks that via<em> Toolkit.getToolkit().canStartNestedEventLoop() </em>and throws an exception with the message: "showAndWait is not allowed during animation or layout processing".</div>

<div>Therefore we need to delay it via <em>Platform.runLater(..)</em>.</div>

<div> </div>

<div>We do that by checking the same method as the dialog:</div>

<div>
<pre>Toolkit.getToolkit().canStartNestedEventLoop()</pre>
</div>

<div>If this method will return false, we will delay the dialog.</div>

<div>Currently, there is no (other) public way to check, whether it is safe right now to show a dialog other than the internal <em>Toolkit</em> class (com.sun.javafx.tk.Toolkit).</div>

<div> </div>

<div>Therefore I propose to add a method to the existing <em>Platform</em> class:</div>

<div><strong>Platform.canStartNestedEventLoop()</strong></div>

<div>which will like many other method just call <em>Toolkit.getToolkit().canStartNestedEventLoop()</em>.</div>

<div> </div>

<div>For reference, see also:</div>

<div>Platform.isNestedLoopRunning()<br/>
Platform.enterNestedEventLoop(..)<br/>
Platform.exitNestedEventLoop(..)</div>

<div> </div>

<div>-- Marius</div></div></body></html>