Author: bobtarling Date: 2008-11-03 12:23:35-0800 New Revision: 15959 Modified: trunk/src/argouml-app/src/org/argouml/cognitive/ui/ToDoPane.java
Log: Issue 5420: Block the todo thread until the AWT thread has caught up. Modified: trunk/src/argouml-app/src/org/argouml/cognitive/ui/ToDoPane.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/cognitive/ui/ToDoPane.java?view=diff&rev=15959&p1=trunk/src/argouml-app/src/org/argouml/cognitive/ui/ToDoPane.java&p2=trunk/src/argouml-app/src/org/argouml/cognitive/ui/ToDoPane.java&r1=15958&r2=15959 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/cognitive/ui/ToDoPane.java (original) +++ trunk/src/argouml-app/src/org/argouml/cognitive/ui/ToDoPane.java 2008-11-03 12:23:35-0800 @@ -31,6 +31,7 @@ import java.awt.event.ItemListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import java.lang.reflect.InvocationTargetException; import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; @@ -361,9 +362,10 @@ // ToDoListListener implementation /** - * Invoke a task on the Swing thread. If we are running on the Swing thread, - * this happens immediately. Otherwise the task is queued for later - * execution using SwingUtilities.invokeLater. + * Invoke a task on the Swing thread. If we are running on the Swing + * thread, this happens immediately. Otherwise the task is queued for later + * execution using SwingUtilities.invokeLater (actually for the moment + * invokeAndWait but this should be resolved in future). * <p> * This is necessary because event notification of ToDoListener events is * likely to be coming from the ToDo Validity Checker thread running in the @@ -375,7 +377,20 @@ if (SwingUtilities.isEventDispatchThread()) { task.run(); } else { - SwingUtilities.invokeLater(task); + // TODO: We really want to use invokeLater here but there is some + // threading problem with doing so. I assume we have some problem + // with the GUI querying the todo list as a reaction to a todo + // event instead of only using the information contained within + // that event. + // With the current invokeAndWait solution we are blocking the GUI + // in the todo thread - Bob. + try { + SwingUtilities.invokeAndWait(task); + } catch (InterruptedException e) { + LOG.error("Exception", e); + } catch (InvocationTargetException e) { + LOG.error("Exception", e); + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
