use of org.eclipse.swtbot.swt.finder.results.BoolResult 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.results.BoolResult in project dsl-devkit by dsldevkit.
the class CheckWizardTestUtil method waitForGrammarFieldEnabled.
/**
* Waits until the grammar field combo box is enabled.
*
* @param wizard
* the wizard
*/
public static void waitForGrammarFieldEnabled(final SwtWizardBot wizard) {
boolean wizardIsActive = syncExec(new BoolResult() {
@Override
public Boolean run() {
SWTBotShell wizardShell = wizard.activeShell();
return wizardShell.widget.getData() instanceof WizardDialog;
}
});
assertTrue("Wizard is active before waiting on grammar field", wizardIsActive);
wizard.waitUntil(Conditions.widgetIsEnabled(wizard.comboBoxWithLabel(Messages.GRAMMAR_FIELD_NAME_LABEL)), 2 * SwtWizardBot.SWTBOT_TIMEOUT);
}
Aggregations