use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project dsl-devkit by dsldevkit.
the class SwtWorkbenchBot method waitUntilWizardPageAppears.
/**
* Waits until a wizard page with the given title is visible and active.
*
* @param wizardPageTitle
* the title of the wizard page
*/
public void waitUntilWizardPageAppears(final String wizardPageTitle) {
waitUntil(new ICondition() {
@Override
@SuppressWarnings("PMD.JUnit4TestShouldUseTestAnnotation")
public boolean test() {
return syncExec(new BoolResult() {
@Override
public Boolean run() {
SWTBotShell wizardShell = activeShell();
if (wizardShell.widget.getData() instanceof WizardDialog) {
return ((WizardDialog) wizardShell.widget.getData()).getCurrentPage().getTitle().equals(wizardPageTitle);
}
return false;
}
});
}
@Override
public void init(final SWTBot paramSWTBot) {
}
@Override
public String getFailureMessage() {
return NLS.bind("Failed to find the wizard page with title ''{0}''.", wizardPageTitle);
}
});
// additionally, we need to wait until the wizard page has finished loading (button cancel is enabled).
waitUntil(new ICondition() {
@Override
@SuppressWarnings("PMD.JUnit4TestShouldUseTestAnnotation")
public boolean test() {
return button("Cancel").isEnabled();
}
@Override
public void init(final SWTBot bot) {
}
@Override
public String getFailureMessage() {
return NLS.bind("Failed while waiting for the wizard page with title ''{0}''.", wizardPageTitle);
}
});
sleep(DELAY_WIZARD_PAGE);
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project dsl-devkit by dsldevkit.
the class CoreSwtbotTools method checkOpenWindow.
/**
* Returns {@code true} if the SWTBot finds the specified window.
*
* @param bot
* the {@link SWTWorkbenchBot}, must not be {@code null}
* @param windowName
* the name of the window to search for, must not be {@code null}
* @return {@code true} if a window was found, {@code false} otherwise
*/
public static boolean checkOpenWindow(final SWTWorkbenchBot bot, final String windowName) {
Assert.isNotNull(bot, ARGUMENT_BOT);
Assert.isNotNull(windowName, "windowName");
Boolean windowFound = false;
try {
final SWTBotShell shell = bot.shell(windowName);
shell.isActive();
windowFound = true;
} catch (WidgetNotFoundException exception) {
throw new WrappedException("Error during searching for window", exception);
}
return windowFound;
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project dsl-devkit by dsldevkit.
the class CoreSwtbotTools method switchPerspective.
/**
* Switching to a new Perspective.
*
* @param bot
* to work with, must not be {@code null}
* @param perspective
* the new perspective to open, must not be {@code null}
*/
public static void switchPerspective(final SWTWorkbenchBot bot, final String perspective) {
Assert.isNotNull(bot, ARGUMENT_BOT);
Assert.isNotNull(perspective, "perspective");
// Change the perspective via the Open Perspective dialog
bot.menu("Window").menu("Open Perspective").menu("Other...").click();
final SWTBotShell shell = bot.shell("Open Perspective");
shell.activate();
// select the dialog
bot.table().select(perspective);
bot.button("OK").click();
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project dsl-devkit by dsldevkit.
the class SwtWizardBot method closeWizard.
/**
* Close the wizard.
*/
public void closeWizard() {
SWTBotShell activeShell = activeShell();
boolean wizardIsActive = isWizard(activeShell);
assertTrue("Wizard is active on close", wizardIsActive);
activeShell.close();
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotShell in project eclipse-integration-commons by spring-projects.
the class StsUiTestCase method cleanUp.
protected void cleanUp() throws Exception {
List<? extends SWTBotEditor> editors = bot.editors();
for (SWTBotEditor editor : editors) {
editor.close();
}
StsTestUtil.deleteAllProjects();
Shell mainWidget = UIThreadRunnable.syncExec(new Result<Shell>() {
public Shell run() {
return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
}
});
SWTBotShell[] shells = bot.shells();
SWTBotShell mainShell = null;
for (SWTBotShell shell : shells) {
if (shell.widget != mainWidget) {
shell.close();
} else {
mainShell = shell;
}
}
if (mainShell != null) {
mainShell.activate();
}
}
Aggregations