Bug 541519: SWTBotFactory.widgets() searches widgets from wrong parent Change-Id: I7a03193d29571ad75eee11e30c14b03dba6b6cff Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
diff --git a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/SWTBotFactory.java b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/SWTBotFactory.java index b3fb8bb..9399b68 100644 --- a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/SWTBotFactory.java +++ b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/SWTBotFactory.java
@@ -372,7 +372,7 @@ /** * @param matcher the matcher used to match widgets. * @param parentWidget the parent widget to search for a given widget. - * @return a list of widgets that match the matcher. + * @return a list of widgets in the parent widget that match the matcher. */ public <T extends Widget> List<? extends T> widgets(Matcher<T> matcher, Widget parentWidget) { WaitForObjectCondition<T> waitForWidget = waitForWidget(matcher, parentWidget); @@ -382,10 +382,12 @@ /** * @param matcher the matcher used to match widgets. - * @return a list of widgets in the active shell that match the matcher. + * @return a list of widgets that match the matcher. */ public <T extends Widget> List<? extends T> widgets(Matcher<T> matcher) { - return widgets(matcher, activeShell().widget); + WaitForObjectCondition<T> waitForWidget = waitForWidget(matcher); + waitUntilWidgetAppears(waitForWidget); + return waitForWidget.getAllMatches(); } /**