--- old/test/java/awt/regtesthelpers/Util.java 2012-04-23 14:41:14.000000000 +0400
+++ new/test/java/awt/regtesthelpers/Util.java 2012-04-23 14:41:14.000000000 +0400
@@ -600,4 +600,34 @@
time, printEvent);
}
+
+
+ /**
+ * Invokes the task
on the EDT thread.
+ *
+ * @return result of the task
+ */
+ public static T invokeOnEDT(final java.util.concurrent.Callable task) throws Exception {
+ final java.util.List result = new java.util.ArrayList(1);
+ final Exception[] exception = new Exception[1];
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ result.add(task.call());
+ } catch (Exception e) {
+ exception[0] = e;
+ }
+ }
+ });
+
+ if (exception[0] != null) {
+ throw exception[0];
+ }
+
+ return result.get(0);
+ }
+
}