Currently, TextActions.updateTextActions does not catch the
IllegalStateException that is sometimes thrown from
Clipboard.isDataFlavorAvailable (when the clipboard is currently unavailable).
This typically happens on Windows, when other applications are writing to the
clipboard, as far as I understand. I've never seen it on the Mac.
The exception is documented, but one could argue that this is a bug in the JDK.
Both as there is no way to check if the clipboard is available, and there is
nothing the programmer can do to guard against it (the exception should at least
be checked, to be consistent with other JDK code, even though I personally don't
particularly like checked exceptions).
In any way, the exception must be caught, to guard the EDT. I don't really know
the appropriate action to take in such case, but maybe try again at a later time?
More info on the bug can be found here:
http://bugs.sun.com/view_bug.do?bug_id=4444868 (same problem in NetBeans, now
fixed), and here: http://bugs.sun.com/view_bug.do?bug_id=4464162 (JDK).
java.lang.IllegalStateException: cannot open system clipboard
at sun.awt.windows.WClipboard.openClipboard(Native Method)