Esempio n. 1
0
  public void confirmShellShareProjectFiles(String project, String[] files, JID[] jids) {
    SWTBot bot = new SWTBot();
    SWTBotShell shell = bot.shell(SHELL_SHARE_PROJECT);
    shell.activate();

    // wait for tree update
    bot.sleep(500);

    SWTBotTree tree = shell.bot().tree();

    selectProjectFiles(tree, project, files);

    shell.bot().button(NEXT).click();

    // wait for tree update
    bot.sleep(500);

    tree = shell.bot().tree();

    for (SWTBotTreeItem item : tree.getAllItems()) while (item.isChecked()) item.uncheck();

    for (JID jid : jids)
      WidgetUtil.getTreeItemWithRegex(tree, Pattern.quote(jid.getBase()) + ".*").check();

    shell.bot().button(FINISH).click();
    bot.waitUntil(Conditions.shellCloses(shell));
  }
Esempio n. 2
0
  @Override
  public void confirmShellCreateNewXMPPAccount(JID jid, String password) throws RemoteException {
    SWTBotShell shell = new SWTBot().shell(SHELL_CREATE_XMPP_JABBER_ACCOUNT);
    shell.activate();

    shell.bot().textWithLabel(LABEL_XMPP_JABBER_SERVER).setText(jid.getDomain());
    shell.bot().textWithLabel(LABEL_USER_NAME).setText(jid.getName());
    shell.bot().textWithLabel(LABEL_PASSWORD).setText(password);
    shell.bot().textWithLabel(LABEL_REPEAT_PASSWORD).setText(password);

    shell.bot().button(FINISH).click();
    try {
      shell.bot().waitUntil(Conditions.shellCloses(shell));
    } catch (TimeoutException e) {
      String errorMessage = ((WizardDialog) shell.widget.getData()).getMessage();
      if (errorMessage.matches(ERROR_MESSAGE_TOO_FAST_REGISTER_ACCOUNTS + ".*"))
        throw new RuntimeException("you are not allowed to register accounts so fast");
      else if (errorMessage.matches(ERROR_MESSAGE_ACCOUNT_ALREADY_EXISTS + ".*\n*.*"))
        throw new RuntimeException("the Account " + jid.getBase() + " already exists");
    }
  }
Esempio n. 3
0
  /**
   * Creates the message that invitees see on an incoming project share request.
   *
   * @param inviter
   * @param projects
   * @return
   */
  protected static String getShareProjectDescription(JID inviter, IProject[] projects) {
    String result = inviter.getBase() + " has invited you to a Saros session";

    if (projects.length == 1) {
      result += " with the shared project\n";
    } else if (projects.length > 1) {
      result += " with the shared projects\n";
    }
    for (IProject project : projects) {
      result += "\n - " + project.getName();
    }

    return result;
  }
Esempio n. 4
0
  @Override
  public void confirmShellAddXMPPAccount(JID jid, String password) throws RemoteException {

    SWTBotShell shell = new SWTBot().shell(SHELL_ADD_XMPP_JABBER_ACCOUNT);
    shell.activate();

    /*
     * FIXME with comboBoxInGroup(GROUP_EXISTING_ACCOUNT) you wil get
     * WidgetNoFoundException.
     */
    shell.bot().comboBoxWithLabel(LABEL_XMPP_JABBER_ID).setText(jid.getBase());

    shell.bot().textWithLabel(LABEL_PASSWORD).setText(password);
    shell.bot().button(FINISH).click();
    shell.bot().waitUntil(Conditions.shellCloses(shell));
  }
Esempio n. 5
0
  @Override
  public void confirmShellAddContact(JID jid) throws RemoteException {
    SWTBot bot = new SWTBot();
    SWTBotShell shell = bot.shell(SHELL_ADD_CONTACT_WIZARD);
    shell.activate();

    shell.bot().comboBoxWithLabel(LABEL_XMPP_JABBER_ID).setText(jid.getBase());

    shell.bot().button(FINISH).click();

    bot.sleep(500);

    for (SWTBotShell currentShell : bot.shells()) {
      // FIXME HARDCODED !
      if (currentShell.getText().equals("Contact Unknown")) {
        currentShell.bot().button(YES).click();
        break;
      }
    }
    bot.waitUntil(Conditions.shellCloses(shell));

    // wait for tree update in the saros session view
    bot.sleep(500);
  }