Fix condition for using index in case of Checkbox and PushButton click
buttonText is compared with empty string, instead of null, to match with
Button.getText() return value.
Change-Id: I401154f45da43b9aaadde0b554814bcdd6961f7d
Signed-off-by: Aparna Argade <aprsac@yahoo.com>
diff --git a/org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/framework/rules/simple/CheckboxClickedRule.java b/org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/framework/rules/simple/CheckboxClickedRule.java
index 4503031..19aa9e7 100644
--- a/org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/framework/rules/simple/CheckboxClickedRule.java
+++ b/org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/framework/rules/simple/CheckboxClickedRule.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Red Hat Inc..
+ * Copyright (c) 2012, 2019 Red Hat Inc. 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
@@ -36,7 +36,7 @@
public void initializeForEvent(Event event) {
this.button = (Button)event.widget;
this.buttonText = this.button.getText();
- if (this.buttonText != null) {
+ if (!this.buttonText.equals("")) {
this.buttonText = this.buttonText.replace("&", "");
} else {
this.index = WidgetUtils.getIndex((Button)event.widget);
@@ -49,7 +49,7 @@
List<String> actions = new ArrayList<String>();
StringBuilder code = new StringBuilder();
- if (this.buttonText != null) {
+ if (!this.buttonText.equals("")) {
code.append("bot.checkBox(\"" + this.buttonText + "\")");
} else {
code.append("bot.checkBox(" + this.index + ")");
diff --git a/org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/framework/rules/simple/PushButtonClickedRule.java b/org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/framework/rules/simple/PushButtonClickedRule.java
index d394e08..c653570 100644
--- a/org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/framework/rules/simple/PushButtonClickedRule.java
+++ b/org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/framework/rules/simple/PushButtonClickedRule.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Red Hat Inc..
+ * Copyright (c) 2012, 2019 Red Hat Inc. 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
@@ -36,7 +36,7 @@
public void initializeForEvent(Event event) {
this.button = (Button)event.widget;
this.buttonText = this.button.getText();
- if (this.buttonText != null) {
+ if (!this.buttonText.equals("")) {
this.buttonText = this.buttonText.replace("&", "");
} else {
this.index = WidgetUtils.getIndex((Button)event.widget);
@@ -47,7 +47,7 @@
public List<String> getActions() {
List<String> actions = new ArrayList<String>();
StringBuilder code = new StringBuilder();
- if (this.buttonText != null) {
+ if (!this.buttonText.equals("")) {
code.append("bot.button(\"" + this.buttonText + "\")");
} else {
code.append("bot.button(" + this.index + ")");