use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotPerspective in project eclipse-integration-commons by spring-projects.
the class SWTBotUtils method openPerspective.
/**
* Open a particular perspective, or try to activate it if it can't be
* opened (maybe it already open)
*/
public static void openPerspective(SWTWorkbenchBot bot, String perspectiveLabel) {
SWTBotShell shell = null;
try {
menu(bot, "Window").menu("Open Perspective").menu("Other...").click();
shell = bot.shell("Open Perspective");
// SWTBotUtils.screenshot("openPerspective_"+perspectiveLabel);
assertTrue(shell.isOpen());
bot.waitUntil(SWTBotUtils.widgetMakeActive(shell));
shell.bot().table().select(perspectiveLabel);
shell.bot().button("OK").click();
bot.waitUntil(Conditions.shellCloses(shell));
} catch (Exception e) {
if (shell != null && shell.isOpen())
shell.close();
System.err.println("Couldn't open perspective '" + perspectiveLabel + "'\n" + "trying to activate already open perspective instead");
// maybe somehow the perspective is already opened (by another test
// before us)
SWTBotPerspective perspective = bot.perspectiveByLabel(perspectiveLabel);
perspective.activate();
assertTrue(perspective.isActive());
}
Assert.assertEquals(perspectiveLabel, bot.activePerspective().getLabel());
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotPerspective in project eclipse-pmd by acanda.
the class GUITestCase method openJavaPerspective.
private static void openJavaPerspective(final SWTWorkbenchBot workbenchBot) {
final SWTBotPerspective javaPerspective = workbenchBot.perspectiveById("org.eclipse.jdt.ui.JavaPerspective");
if (!javaPerspective.isActive()) {
workbenchBot.menu("Window").menu("Open Perspective").menu("Java").click();
workbenchBot.waitUntil(isPerspectiveActive(javaPerspective));
}
}
Aggregations