+ SWTBotUtils.closeSecondaryShells(fBot);
+ }
+
+ /**
+ * Class to check number of checked items
+ */
+ static final class TreeCheckedCounter implements Result<Integer> {
+ private final SWTBotTree fTreeBot;
+
+ TreeCheckedCounter(SWTBotTree treeBot) {
+ fTreeBot = treeBot;
+ }
+
+ @Override
+ public Integer run() {
+ int checked = 0;
+ for (TreeItem item : fTreeBot.widget.getItems()) {
+ checked += getChecked(item);
+ }
+ return checked;
+ }
+
+ private int getChecked(TreeItem item) {
+ int total = 0;
+ if (item.getChecked()) {
+ total++;
+ }
+ for (TreeItem child : item.getItems()) {
+ total += getChecked(child);
+ }
+ return total;
+ }