import org.eclipse.swtbot.swt.finder.keyboard.KeyboardFactory;
import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
import org.eclipse.swtbot.swt.finder.matchers.WidgetOfType;
+import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
import org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl;
private static void openDialog(SWTBotView view) {
view.setFocus();
- KEYBOARD.pressShortcut(Keystrokes.HOME);
- KEYBOARD.pressShortcut(Keystrokes.CTRL, KeyStroke.getInstance('F'));
+ SWTBotUtils.pressShortcutGoToTreeTop(KEYBOARD);
+ if (SWTUtils.isMac()) {
+ KEYBOARD.pressShortcut(Keystrokes.COMMAND, KeyStroke.getInstance('F'));
+ } else {
+ KEYBOARD.pressShortcut(Keystrokes.CTRL, KeyStroke.getInstance('F'));
+ }
fBot.waitUntil(Conditions.shellIsActive(DIALOG_TITLE));
}
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.keyboard.Keyboard;
+import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
import org.eclipse.swtbot.swt.finder.results.Result;
import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
return currentNode;
}
+ /**
+ * Press the keyboard shortcut that goes to the top of a tree widget. The
+ * key combination can differ on different platforms.
+ *
+ * @param keyboard
+ * the keyboard to use
+ */
+ public static void pressShortcutGoToTreeTop(Keyboard keyboard) {
+ if (SWTUtils.isMac()) {
+ keyboard.pressShortcut(Keystrokes.ALT, Keystrokes.UP);
+ } else {
+ keyboard.pressShortcut(Keystrokes.HOME);
+ }
+ }
+
/**
* Get the active events editor. Note that this will wait until such editor
* is available.