/**
   * 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();
  }
  private static SWTBotEditor checkActiveEditorTitle(SWTBotExt bot, String expectedOpenedFileName) {

    SWTBotEditor activeEditor = null;
    try {
      bot.waitUntil(
          new ActiveEditorHasTitleCondition(bot, expectedOpenedFileName), Timing.time10S());
      activeEditor = bot.activeEditor();
    } catch (TimeoutException toe) {
      activeEditor = bot.activeEditor();
      fail(
          "Opened file has to have title "
              + expectedOpenedFileName
              + " but has "
              + activeEditor.getTitle());
    }

    return activeEditor;
  }