Author: ljelinko
Date: 2011-11-21 08:08:26 -0500 (Mon, 21 Nov 2011)
New Revision: 36485
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/wizard/WizardOpeningTask.java
Log:
changed code to use SWT bot ext
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/wizard/WizardOpeningTask.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/wizard/WizardOpeningTask.java 2011-11-21
13:07:49 UTC (rev 36484)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/wizard/WizardOpeningTask.java 2011-11-21
13:08:26 UTC (rev 36485)
@@ -1,8 +1,12 @@
package org.jboss.tools.portlet.ui.bot.test.task.wizard;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
import org.jboss.tools.portlet.ui.bot.test.task.AbstractSWTTask;
+import org.jboss.tools.ui.bot.ext.SWTBotFactory;
+import org.jboss.tools.ui.bot.ext.gen.INewObject;
/**
* Opens a specified wizard.
@@ -11,37 +15,44 @@
*
*/
public class WizardOpeningTask extends AbstractSWTTask {
-
+
private String category;
-
+
private String name;
-
+
public WizardOpeningTask(String name) {
super();
this.name = name;
}
-
- public WizardOpeningTask(String name, String category) {
+
+ /**
+ *
+ * @param name Name of the wizard to open
+ * @param categoryPath path to the wizard (categories separated by '/')
+ */
+ public WizardOpeningTask(String name, String categoryPath) {
this(name);
- this.category = category;
+ this.category = categoryPath;
}
@Override
public void perform() {
- getBot().menu("File").menu("New").menu("Other...").click();
-
- SWTBotTree tree = getBot().tree();
- getTreeItem(tree).select();
-
- getBot().button("Next >").click();
+ INewObject wizardPath = new INewObject() {
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public List<String> getGroupPath() {
+ if (category == null){
+ return Collections.emptyList();
+ }
+
+ return Arrays.asList(category.split("/"));
+ }
+ };
+ SWTBotFactory.getOpen().newObject(wizardPath);
}
-
- private SWTBotTreeItem getTreeItem(SWTBotTree tree){
- if (category == null){
- return tree.getTreeItem(name);
- } else {
- tree.expandNode(category);
- return tree.getTreeItem(category).getNode(name);
- }
- }
}