Java 类org.eclipse.swtbot.swt.finder.results.BoolResult 实例源码

项目:dsl-devkit    文件:SwtBotToolbarButtonUtil.java   
/**
 * Returns whether the toolbar button is selected.
 *
 * @param toolbarButton
 *          the {@link SWTBotToolbarButton}, must not be {@code null}
 * @return {@code true} if the toolbar button is selected, {@code false} otherwise
 */
public static boolean isSelected(final SWTBotToolbarButton toolbarButton) {
  Assert.isNotNull(toolbarButton, "toolbarButton");
  return UIThreadRunnable.syncExec(toolbarButton.display, new BoolResult() {
    @Override
    public Boolean run() {
      return toolbarButton.widget.getSelection();
    }
  });
}
项目:dsl-devkit    文件:CheckWizardTestUtil.java   
/**
 * 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);
}
项目:eclipse-plugin    文件:SWTBotBaseTest.java   
private boolean isEclipseShell(final SWTBotShell shell) {
    return UIThreadRunnable.syncExec(new BoolResult() {
        public Boolean run() {
            return PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                             .getShell() == shell.widget;
        }
    });
}
项目:dsl-devkit    文件:SwtWorkbenchBot.java   
/**
 * 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);
}