コード例 #1
0
  private void selectImportFromArchive(String archivePath) {
    SWTBotRadio button = fBot.radio("Select &archive file:");
    button.click();

    SWTBotCombo sourceCombo = fBot.comboBox(1);

    sourceCombo.setText(new File(archivePath).getAbsolutePath());

    SWTBotText text = fBot.text();
    text.setFocus();
  }
コード例 #2
0
  public static void continueInstall(final SWTWorkbenchBot bot, final String shellTitle)
      throws InstallFailureException {
    try {
      bot.radio(0).click();
      bot.button("Finish").click();
      // wait for Security pop-up, or install finished.
      final SWTBotShell shell = bot.shell(shellTitle);
      bot.waitWhile(
          new ICondition() {

            @Override
            public boolean test() throws Exception {
              return shell.isActive();
            }

            @Override
            public void init(SWTBot bot) {}

            @Override
            public String getFailureMessage() {
              return null;
            }
          },
          installationTimeout);
      if (bot.activeShell().getText().equals("Security Warning")) {
        bot.button("OK").click();
        System.err.println("OK clicked");
        bot.waitUntil(
            new ICondition() {
              @Override
              public boolean test() throws Exception {
                try {
                  boolean stillOpen = bot.shell(shellTitle).isOpen();
                  System.err.println("still open? " + stillOpen);
                  return !stillOpen;
                } catch (WidgetNotFoundException ex) {
                  System.err.println("no shell");
                  // Shell already closed
                  return true;
                }
              }

              @Override
              public void init(SWTBot bot) {}

              @Override
              public String getFailureMessage() {
                return null;
              }
            },
            installationTimeout); // 15 more minutes
      }
      SWTBot restartShellBot = bot.shell("Software Updates").bot();
      // Don't restart in test, test executor will do it.
      try {
        // Eclipse 4.2 => "No"
        restartShellBot.button("No").click();
      } catch (WidgetNotFoundException ex) {
        // Eclipse 3.7.x => "Not now"
        restartShellBot.button("Not Now").click();
      }
    } catch (Exception ex) {

      String installDesc = bot.text().getText();
      if (installDesc == null || installDesc.isEmpty()) {
        throw new RuntimeException("Internal error", ex);
      }
      throw new InstallFailureException(installDesc);
    }
  }