Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
index b71c1da62..36b5c2788 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
@@ -167,6 +167,25 @@ public class TestUtil {
}
/**
+ * Process all queued UI events. If called from background thread, blocks
+ * until all pending events are processed in UI thread.
+ */
+ public static void processUIEvents() {
+ if (Display.getCurrent() != null) {
+ while (Display.getCurrent().readAndDispatch()) {
+ // process queued ui events
+ }
+ } else {
+ // synchronously refresh UI
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ processUIEvents();
+ }
+ });
+ }
+ }
+
+ /**
* Appends content to given file.
*
* @param file
@@ -569,6 +588,7 @@ public class TestUtil {
IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
try {
workbenchPage.showView(viewId);
+ processUIEvents();
} catch (PartInitException e) {
throw new RuntimeException("Showing view with ID " + viewId
+ " failed.", e);

Back to the top