コード例 #1
0
  /**
   * Selects specified text in specified opened editor, shows open on options via selecting Navigate
   * -> Open Hyperlink and select one of them specified by openOnOption
   *
   * @param bot
   * @param editorTitle
   * @param textToSelect
   * @param selectionOffset
   * @param selectionLength
   * @param textToSelectIndex
   * @param openOnOption
   */
  public static SWTBotEditor selectOpenOnOption(
      SWTBotExt bot,
      String editorTitle,
      String textToSelect,
      int selectionOffset,
      int selectionLength,
      int textToSelectIndex,
      String openOnOption) {
    showOpenOnOptions(
        bot, editorTitle, textToSelect, selectionOffset, selectionLength, textToSelectIndex);

    SWTBotTable table = bot.activeShell().bot().table(0);

    boolean optionFound = false;
    String foundOptions = "";

    for (int i = 0; i < table.rowCount(); i++) {
      String foundOption = table.getTableItem(i).getText();
      foundOptions = foundOptions + foundOption + ", ";
      if (foundOption.contains(openOnOption)) {
        optionFound = true;
        table.click(i, 0);
        break;
      }
    }
    foundOptions = foundOptions.substring(0, foundOptions.length() - 3);
    assertTrue(
        openOnOption
            + " was not found in open on options of "
            + textToSelect
            + " Found: "
            + foundOptions,
        optionFound);
    return bot.activeEditor();
  }
コード例 #2
0
 private void removeRuntimeLibrary(
     final SWTBotTree tree, SWTBotTreeItem item, SWTBotExt bot, SWTUtilExt util) {
   nodeContextMenu(tree, item, "Build Path", "Configure Build Path...").click();
   bot.activeShell().activate();
   bot.tabItem("Libraries").activate();
   assertTrue(!bot.button("Remove").isEnabled());
   try {
     findSelectEnterpriseRuntimeLibrary(bot);
     assertTrue(bot.button("Remove").isEnabled());
     bot.button("Remove").click();
     bot.button("OK").click();
     util.waitForNonIgnoredJobs();
   } catch (Exception e) {
     e.printStackTrace();
     bot.button("Cancel").click();
   }
 }