Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2012-03-15 14:43:32 +0000
committerMarkus Tiede2012-03-15 14:43:32 +0000
commitfe9545a71f6f9962b1417942fc101b5ae3ad842c (patch)
tree3e445ccaf7b00f82aa3c07b9713ac7db5c91e60c
parent7db8884c6217e308c9ed37da992274488457fdbe (diff)
downloadorg.eclipse.jubula.core-fe9545a71f6f9962b1417942fc101b5ae3ad842c.tar.gz
org.eclipse.jubula.core-fe9545a71f6f9962b1417942fc101b5ae3ad842c.tar.xz
org.eclipse.jubula.core-fe9545a71f6f9962b1417942fc101b5ae3ad842c.zip
Sprint task -fix for issue 374357.
-rw-r--r--org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/implclasses/MenuUtil.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/implclasses/MenuUtil.java b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/implclasses/MenuUtil.java
index 3138ef272..8b5171dcf 100644
--- a/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/implclasses/MenuUtil.java
+++ b/org.eclipse.jubula.rc.swing/src/org/eclipse/jubula/rc/swing/swing/implclasses/MenuUtil.java
@@ -73,7 +73,7 @@ public abstract class MenuUtil extends MenuUtilBase {
*
* @param mb the menu bar
* @param idx the index of the menu to find
- * @return the menu
+ * @return the menu, or <code>null</code> if not found
*/
public static JMenu findMenu(JMenuBar mb, int idx) {
List visibleSubMenus = new ArrayList();
@@ -87,7 +87,7 @@ public abstract class MenuUtil extends MenuUtilBase {
}
}
- if (idx >= visibleSubMenus.size()) {
+ if (idx >= visibleSubMenus.size() || idx < 0) {
return null;
}
@@ -217,7 +217,9 @@ public abstract class MenuUtil extends MenuUtilBase {
public static void closeMenu(IRobot robot, JMenuBar menuBar, int item) {
if (menuBar.getSelectionModel().getSelectedIndex() == item) {
JMenu menu = findMenu(menuBar, item);
- clickMenuItem(robot, menu);
+ if (menu != null) {
+ clickMenuItem(robot, menu);
+ }
}
}
@@ -231,7 +233,9 @@ public abstract class MenuUtil extends MenuUtilBase {
final int index = getItemNumber(menuBar, item);
if (menuBar.getSelectionModel().getSelectedIndex() == index) {
JMenu menu = findMenu(menuBar, index);
- clickMenuItem(robot, menu);
+ if (menu != null) {
+ clickMenuItem(robot, menu);
+ }
}
}

Back to the top