Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Tasse2016-04-11 20:20:39 +0000
committerPatrick Tasse2016-04-11 20:20:39 +0000
commit3fdd729ad8f7b777b03810ece360743a686f18cb (patch)
tree2e46fc33ae5515ccae32c960c249c9a973c49be6
parente0251857f26c76ac93770775284bb7c85f761101 (diff)
downloadorg.eclipse.swtbot-3fdd729ad8f7b777b03810ece360743a686f18cb.tar.gz
org.eclipse.swtbot-3fdd729ad8f7b777b03810ece360743a686f18cb.tar.xz
org.eclipse.swtbot-3fdd729ad8f7b777b03810ece360743a686f18cb.zip
Bug 491472: TimeoutException thrown instead of WidgetNotFoundException2.4.0
Methods that find menus or menu items specify that they throw a WidgetNotFoundException, but sometimes throw a TimeoutException instead. The methods are fixed to throw a WidgetNotFoundException. The Javadoc is updated with a @throws tag where it was missing. Change-Id: Ic4e035f74ceff867d5844f146440a8272ede5538
-rw-r--r--org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotView.java3
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/SWTBotFactory.java15
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/AbstractSWTBot.java4
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotMenu.java6
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotRootMenu.java2
5 files changed, 21 insertions, 9 deletions
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotView.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotView.java
index 5945e6ac..f9a1f79a 100644
--- a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotView.java
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotView.java
@@ -107,11 +107,12 @@ public class SWTBotView extends SWTBotWorkbenchPart<IViewReference> {
* Gets the view menu of this view.
*
* @return the view menu.
+ * @throws WidgetNotFoundException if the widget is not found.
* @since 2.4
*/
public SWTBotRootMenu viewMenu() {
WaitForObjectCondition<Menu> waitForMenu = Conditions.waitForViewMenu(partReference);
- new SWTBot().waitUntil(waitForMenu);
+ new SWTBot().waitUntilWidgetAppears(waitForMenu);
return new SWTBotRootMenu(waitForMenu.get(0));
}
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 9a0d1a7d..9b185b6b 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 Ketan Padegaonkar and others.
+ * Copyright (c) 2008, 2016 Ketan Padegaonkar and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,7 +15,7 @@
* Ketan Patel - (Bug 259860)
* Mickael Istria (Red Hat Inc.) - Bug 422458
* Lorenzo Bettini - https://bugs.eclipse.org/bugs/show_bug.cgi?id=464687
- * Patrick Tasse - Improve SWTBot menu API and implementation (Bug 479091)
+ * Patrick Tasse - Improve SWTBot menu API and implementation (Bug 479091)
*******************************************************************************/
package org.eclipse.swtbot.swt.finder;
@@ -198,6 +198,7 @@ abstract class SWTBotFactory {
* Gets the menu bar of the active shell.
*
* @return the menu bar.
+ * @throws WidgetNotFoundException if the widget is not found.
*/
public SWTBotRootMenu menu() {
return menu(activeShell());
@@ -208,6 +209,7 @@ abstract class SWTBotFactory {
*
* @param shell the shell.
* @return the menu bar.
+ * @throws WidgetNotFoundException if the widget is not found.
*/
public SWTBotRootMenu menu(SWTBotShell shell) {
WaitForObjectCondition<Menu> waitForMenu = Conditions.waitForMenuBar(shell);
@@ -225,6 +227,7 @@ abstract class SWTBotFactory {
* @param text
* the text on the menu.
* @return a menu item that matches the specified text.
+ * @throws WidgetNotFoundException if the widget is not found.
*/
public SWTBotMenu menu(String text) {
return menu().menu(text, true, 0);
@@ -240,6 +243,7 @@ abstract class SWTBotFactory {
* @param text the text on the menu.
* @param index the index of the menu item, in case there are multiple matching menu items.
* @return a menu item that matches the specified text.
+ * @throws WidgetNotFoundException if the widget is not found.
*/
public SWTBotMenu menu(String text, int index) {
return menu().menu(text, true, index);
@@ -255,6 +259,7 @@ abstract class SWTBotFactory {
* @param text the text on the menu.
* @param recursive if set to true, will find depth-first in sub-menus as well.
* @return a menu item that matches the specified text.
+ * @throws WidgetNotFoundException if the widget is not found.
* @since 2.3
*/
public SWTBotMenu menu(String text, boolean recursive) {
@@ -272,6 +277,7 @@ abstract class SWTBotFactory {
* @param value the value of the id.
* @return a wrapper around a @{link MenuItem} with the specified key/value pair for its id.
* @see SWTBotPreferences#DEFAULT_KEY
+ * @throws WidgetNotFoundException if the widget is not found.
*/
public SWTBotMenu menuWithId(String value) {
return menu().menuWithId(SWTBotPreferences.DEFAULT_KEY, value, true, 0);
@@ -289,6 +295,7 @@ abstract class SWTBotFactory {
* @param index the index of the menu item, in case there are multiple matching menu items.
* @return a wrapper around a @{link MenuItem} with the specified key/value pair for its id.
* @see SWTBotPreferences#DEFAULT_KEY
+ * @throws WidgetNotFoundException if the widget is not found.
*/
public SWTBotMenu menuWithId(String value, int index) {
return menu().menuWithId(SWTBotPreferences.DEFAULT_KEY, value, true, index);
@@ -304,6 +311,7 @@ abstract class SWTBotFactory {
* @param key the key of the id.
* @param value the value of the id.
* @return a wrapper around a @{link MenuItem} with the specified key/value pair for its id.
+ * @throws WidgetNotFoundException if the widget is not found.
*/
public SWTBotMenu menuWithId(String key, String value) {
return menu().menuWithId(key, value, true, 0);
@@ -320,6 +328,7 @@ abstract class SWTBotFactory {
* @param value the value of the id.
* @param index the index of the menu item, in case there are multiple matching menu items.
* @return a wrapper around a @{link Menu} with the specified key/value pair for its id.
+ * @throws WidgetNotFoundException if the widget is not found.
*/
public SWTBotMenu menuWithId(String key, String value, int index) {
return menu().menuWithId(key, value, true, index);
@@ -336,6 +345,7 @@ abstract class SWTBotFactory {
* @param matcher the matcher used to find the menu.
* @param index the index of the menu item, in case there are multiple matching menu items.
* @return a menu item that matches the specified matcher.
+ * @throws WidgetNotFoundException if the widget is not found.
*/
public SWTBotMenu menu(SWTBotShell shell, Matcher<MenuItem> matcher, int index) {
return menu(shell).menu(matcher, true, index);
@@ -352,6 +362,7 @@ abstract class SWTBotFactory {
* @param matcher the matcher used to find the menu.
* @param recursive if set to true, will find depth-first in sub-menus as well.
* @return a menu item that matches the specified matcher.
+ * @throws WidgetNotFoundException if the widget is not found.
* @since 2.2
*/
public SWTBotMenu menu(SWTBotShell shell, Matcher<MenuItem> matcher, boolean recursive) {
diff --git a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/AbstractSWTBot.java b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/AbstractSWTBot.java
index f949ba21..ec20eb98 100644
--- a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/AbstractSWTBot.java
+++ b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/AbstractSWTBot.java
@@ -8,7 +8,7 @@
* Contributors:
* Ketan Padegaonkar - initial API and implementation
* Lorenzo Bettini - (Bug 426869) mark new methods with since annotation
- * Patrick Tasse - Improve SWTBot menu API and implementation (Bug 479091)
+ * Patrick Tasse - Improve SWTBot menu API and implementation (Bug 479091)
* Aparna Argade(Cadence Design Systems, Inc.) - Bug 489179
*******************************************************************************/
package org.eclipse.swtbot.swt.finder.widgets;
@@ -440,7 +440,7 @@ public abstract class AbstractSWTBot<T extends Widget> {
ContextMenuHelper.notifyMenuDetect(control, widget);
WaitForObjectCondition<Menu> waitForMenu = Conditions.waitForPopupMenu(control);
- new SWTBot().waitUntil(waitForMenu);
+ new SWTBot().waitUntilWidgetAppears(waitForMenu);
return new SWTBotRootMenu(waitForMenu.get(0));
}
diff --git a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotMenu.java b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotMenu.java
index 38cc3727..cca7559b 100644
--- a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotMenu.java
+++ b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotMenu.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 Ketan Padegaonkar and others.
+ * Copyright (c) 2008, 2016 Ketan Padegaonkar and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* Ketan Padegaonkar - initial API and implementation
* Patrick Tasse - Fix radio menu item click behavior (Bug 451126 & Bug 397649)
- * - Improve SWTBot menu API and implementation (Bug 479091)
+ * - Improve SWTBot menu API and implementation (Bug 479091)
*******************************************************************************/
package org.eclipse.swtbot.swt.finder.widgets;
@@ -256,7 +256,7 @@ public class SWTBotMenu extends AbstractSWTBot<MenuItem> {
*/
public SWTBotMenu menu(Matcher<MenuItem> matcher, final boolean recursive, final int index) throws WidgetNotFoundException {
WaitForObjectCondition<MenuItem> waitForMenuItem = Conditions.waitForMenuItem(this, matcher, recursive, index);
- new SWTBot().waitUntil(waitForMenuItem);
+ new SWTBot().waitUntilWidgetAppears(waitForMenuItem);
return new SWTBotMenu(waitForMenuItem.get(0), matcher);
}
diff --git a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotRootMenu.java b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotRootMenu.java
index 06562cd4..1507eab1 100644
--- a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotRootMenu.java
+++ b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotRootMenu.java
@@ -119,7 +119,7 @@ public class SWTBotRootMenu extends AbstractSWTBot<Menu> {
*/
public SWTBotMenu menu(final Matcher<MenuItem> matcher, final boolean recursive, final int index) throws WidgetNotFoundException {
WaitForObjectCondition<MenuItem> waitForMenuItem = Conditions.waitForMenuItem(this, matcher, recursive, index);
- new SWTBot().waitUntil(waitForMenuItem);
+ new SWTBot().waitUntilWidgetAppears(waitForMenuItem);
return new SWTBotMenu(waitForMenuItem.get(0), matcher);
}

Back to the top