@Override public void confirmShellShareProjects(String[] projectNames, JID... jids) throws RemoteException { 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(); for (SWTBotTreeItem item : tree.getAllItems()) while (item.isChecked()) item.uncheck(); for (String projectName : projectNames) tree.getTreeItem(projectName).check(); 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(); } }