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)); }
private void selectProjectFiles(SWTBotTree tree, String project, String[] files) { for (SWTBotTreeItem item : tree.getAllItems()) while (item.isChecked()) item.uncheck(); for (String file : files) { String[] nodes = file.split("/|\\\\"); List<String> regex = new ArrayList<String>(nodes.length + 1); regex.add(Pattern.quote(project)); for (String node : nodes) regex.add(Pattern.quote(node)); WidgetUtil.getTreeItemWithRegex(tree, regex.toArray(new String[0])).check(); } }
@Override public void confirmShellAddContactsToSession(String... baseJIDOfinvitees) throws RemoteException { SWTBot bot = new SWTBot(); SWTBotShell shell = bot.shell(SHELL_ADD_CONTACT_TO_SESSION); shell.activate(); // wait for tree update bot.sleep(500); SWTBotTree tree = shell.bot().tree(); for (String baseJID : baseJIDOfinvitees) WidgetUtil.getTreeItemWithRegex(tree, Pattern.quote(baseJID) + ".*").check(); shell.bot().button(FINISH).click(); bot.waitUntil(Conditions.shellCloses(shell)); // wait for tree update in the saros session view bot.sleep(500); }