tmf: Try expanding a second time when tree expand fails
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Wed, 18 Nov 2015 06:06:30 +0000 (01:06 -0500)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Thu, 14 Jan 2016 14:42:39 +0000 (09:42 -0500)
This will stabilize StandardImportAndReadSmokeTest.
Sometimes in a JFace TreeViewer, it expands to nothing.
It looks like a timing issue with an update job started by the viewer.
This is a work around until we can investigate some more.

Change-Id: I01ead54ec7ff7baaf64e1184c3a5cae8906b86a9
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/60677
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java

index 1e4b3051d11f1a061fa7ade60b5c819495d92ff3..71995f8cc0f049378d5cdc27eb85b563c9f4666e 100644 (file)
@@ -52,6 +52,7 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.swtbot.swt.finder.widgets.TimeoutException;
 import org.eclipse.tracecompass.tmf.ui.editors.TmfEventsEditor;
 import org.eclipse.tracecompass.tmf.ui.project.model.TmfOpenTraceHelper;
 import org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectRegistry;
@@ -562,7 +563,15 @@ public final class SWTBotUtils {
             currentNode.expand();
 
             String nodeName = nodeNames[i];
-            bot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(nodeName, currentNode));
+            try {
+                bot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(nodeName, currentNode));
+            } catch (TimeoutException e) {
+                //FIXME: Sometimes in a JFace TreeViewer, it expands to nothing. Need to find out why.
+                currentNode.collapse();
+                currentNode.expand();
+                bot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(nodeName, currentNode));
+            }
+
             SWTBotTreeItem newNode = currentNode.getNode(nodeName);
             currentNode = newNode;
         }
This page took 0.025308 seconds and 5 git commands to generate.