@Override public boolean test() throws Exception { Matcher<Shell> matcher = WidgetMatcherFactory.withText(title); bot.waitUntil(Conditions.waitForShell(matcher)); SWTBotShell shell = bot.shell(title); return shell!=null; }
private SWTBotShell getPreferenceDialog() { Matcher<Shell> matcher = WidgetMatcherFactory.withText("Preferences"); bot.waitUntil(Conditions.waitForShell(matcher)); SWTBotShell shell = bot.shell("Preferences"); shell.activate(); return shell; }
/** * Returns the {@link SWTBotMenu}s available on the given widget bot. * * @param widgetBot * the bot representing the widget, whose {@link SWTBotMenu}s should be returned * @return the {@link SWTBotMenu}s on the given widget bot */ public static List<SWTBotMenu> getContextMenuItems(final AbstractSWTBot<? extends Control> widgetBot) { return UIThreadRunnable.syncExec(new Result<List<SWTBotMenu>>() { @Override public List<SWTBotMenu> run() { List<SWTBotMenu> menuItems = Lists.newArrayList(); for (MenuItem menuItem : new ContextMenuFinder(widgetBot.widget).findMenus(widgetBot.widget.getShell(), WidgetMatcherFactory.widgetOfType(MenuItem.class), true)) { menuItems.add(new SWTBotMenu(menuItem)); } return menuItems; } }); }
/** * Returns the disabled {@link SWTBotMenu}s on the given widget bot. * * @param widgetBot * the bot representing the widget, whose disabled {@link SWTBotMenu}s should be returned * @return the disabled {@link SWTBotMenu}s on the given widget bot */ public static List<SWTBotMenu> getDisabledContextMenuItems(final AbstractSWTBot<? extends Control> widgetBot) { return UIThreadRunnable.syncExec(new Result<List<SWTBotMenu>>() { @Override public List<SWTBotMenu> run() { List<SWTBotMenu> disabledMenuItems = Lists.newArrayList(); for (MenuItem menuItem : new ContextMenuFinder(widgetBot.widget).findMenus(widgetBot.widget.getShell(), WidgetMatcherFactory.widgetOfType(MenuItem.class), true)) { if (!menuItem.isEnabled()) { disabledMenuItems.add(new SWTBotMenu(menuItem)); } } return disabledMenuItems; } }); }
@Override public boolean test() throws Exception { MenuFinder finder = getMenuFinder(); SwtBotUtils.print("ActiveShellMenu: Getting menus for shell: " + bot.activeShell().getText()); SwtBotUtils.print("ActiveShellMenu: Is active: " + bot.activeShell().isActive() + ""); Matcher<MenuItem> menuMatcher = WidgetMatcherFactory.withMnemonic(name); Shell shell = bot.activeShell().widget; found = finder.findMenus(shell, menuMatcher, recursive); boolean hasFound = found != null && found.size() > 0; SwtBotUtils.print("ActiveShellMenu: Has found menus: '" + hasFound + "' for: " + name); return hasFound; }
private void showGW4EPreference(SWTBotShell shell) { bot.tree().select("GW4E Preferences"); Matcher<Shell> matcher = WidgetMatcherFactory.withId("id", PreferenceManager.AUTHORIZED_FOLDERS_FOR_GRAPH_DEFINITION); bot.waitUntil(Conditions.waitForWidget(matcher, shell.widget)); }
/** * Creates a new instance of {@link WaitForTable}. * * @param parent * the parent {@link Table}, must not be {@code null} */ public WaitForTable(final Table parent) { super(WidgetMatcherFactory.widgetOfType(TableItem.class)); Assert.isNotNull(parent, "parent"); this.parent = parent; }
/** * Creates a new instance of {@link WaitForTree}. * * @param parent * the parent {@link Tree}, must not be {@code null} */ public WaitForTree(final Tree parent) { super(WidgetMatcherFactory.widgetOfType(TreeItem.class)); Assert.isNotNull(parent, "parent"); this.parent = parent; }