swtbot: Fix TestTraceOffsetting

Do not call pressShortcut() on the tree item. This gives focus to the
tree, which takes away focus from the cell editor.

Instead find the cell editor text and call pressShortcut() on it.

Change-Id: Ia063cdc56f40611dac00a78a81c808773cfc375d
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/134215
Tested-by: CI Bot
Reviewed-by: Simon Delisle <simon.delisle@ericsson.com>
Tested-by: Simon Delisle <simon.delisle@ericsson.com>
(cherry picked from commit 16f950589ac85b555b4a3d47805aa31990906265)
Reviewed-on: https://git.eclipse.org/r/134332
Reviewed-on: https://git.eclipse.org/r/137754
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/TestTraceOffsetting.java b/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/TestTraceOffsetting.java
index 9e13718..d200729 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/TestTraceOffsetting.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/TestTraceOffsetting.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2015 Ericsson
+ * Copyright (c) 2015, 2018 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -34,6 +34,7 @@
 import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
 import org.eclipse.tracecompass.internal.tmf.core.Activator;
 import org.eclipse.tracecompass.tmf.core.io.BufferedRandomAccessFile;
@@ -152,9 +153,11 @@
         final SWTBotTreeItem swtBotTreeItem = allItems[0];
         swtBotTreeItem.select();
         swtBotTreeItem.click(1);
-        swtBotTreeItem.pressShortcut(KeyStroke.getInstance('9'));
-        swtBotTreeItem.pressShortcut(KeyStroke.getInstance('9'));
-        swtBotTreeItem.pressShortcut(KeyStroke.getInstance('\n'));
+        // Press shortcuts on the cell editor
+        SWTBotText text = shell.bot().text(1);
+        text.pressShortcut(KeyStroke.getInstance('9'));
+        text.pressShortcut(KeyStroke.getInstance('9'));
+        text.pressShortcut(KeyStroke.getInstance('\n'));
         WaitUtils.waitForJobs();
         fBot.button("OK").click();