closeSecondaryShells(bot);
WaitUtils.waitForJobs();
+ if (!ResourcesPlugin.getWorkspace().getRoot().getProject(projectName).exists()) {
+ return;
+ }
+
final SWTBotView projectViewBot = bot.viewById(IPageLayout.ID_PROJECT_EXPLORER);
projectViewBot.setFocus();
});
}
-
/**
* Focus on the main window
*
// shell such the special "limbo shell" that Eclipse needs to work
Arrays.stream(shells)
.filter(shell -> shell != mainShell)
+ .filter(s -> !s.widget.isDisposed())
.filter(SWTBotShell::isVisible)
.peek(shell -> log.debug(MessageFormat.format("Closing lingering shell with title {0}", shell.getText())))
.forEach(SWTBotShell::close);
* Close a view with an id
*
* @param viewId
- * the view id, like "org.eclipse.linuxtools.tmf.ui.views.histogram"
+ * the view id, like
+ * "org.eclipse.linuxtools.tmf.ui.views.histogram"
* @param bot
* the workbench bot
*/
printEnvironment();
// There seems to be problems on some system where the main shell is
- // not in focus initially. This was seen using Xvfb and Xephyr on some occasions.
+ // not in focus initially. This was seen using Xvfb and Xephyr on
+ // some occasions.
focusMainWindow(bot.shells());
Shell shell = bot.activeShell().widget;
return;
}
- // Print some information about the environment that could affect test outcome
+ // Print some information about the environment that could affect test
+ // outcome
Rectangle bounds = Display.getDefault().getBounds();
System.out.println("Display size: " + bounds.width + "x" + bounds.height);
String gtkVersion = System.getProperty("org.eclipse.swt.internal.gtk.version");
if (gtkVersion != null) {
System.out.println("GTK version=" + gtkVersion);
- // Try to print the GTK theme information as behavior can change depending on the theme
+ // Try to print the GTK theme information as behavior can change
+ // depending on the theme
String gtkTheme = System.getProperty("org.eclipse.swt.internal.gtk.theme");
System.out.println("GTK theme=" + (gtkTheme == null ? "unknown" : gtkTheme));
return (TmfEventsEditor) editorPart;
}
+ /**
+ * Returns the child tree item of the specified item at the given sub-path.
+ * The project element labels may have a count suffix in the format ' [n]'.
+ *
+ * @param bot
+ * a given workbench bot
+ * @param parentItem
+ * the parent tree item
+ * @param path
+ * the desired child element sub-path (without suffix)
+ * @return the a {@link SWTBotTreeItem} with the specified name
+ */
+ public static SWTBotTreeItem getTraceProjectItem(SWTBot bot, final SWTBotTreeItem parentItem, final String... path) {
+ SWTBotTreeItem item = parentItem;
+ for (String name : path) {
+ item = getTraceProjectItem(bot, item, name);
+ }
+ return item;
+ }
+
/**
* Returns the child tree item of the specified item with the given name.
* The project element label may have a count suffix in the format ' [n]'.
* @param bot
* a given workbench bot
* @param projectName
- * the name of the project (it needs to exist or else it would time out)
+ * the name of the project (it needs to exist or else it would
+ * time out)
* @return a {@link SWTBotTreeItem} of the project
*/
public static SWTBotTreeItem selectProject(SWTWorkbenchBot bot, String projectName) {
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.
+ // 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));