Revision e1f2a065
Added by Cherian Mathew almost 9 years ago
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/test/SwtBotUtils.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.util.List; |
4 | 4 |
|
5 |
import org.eclipse.osgi.internal.loader.FilteredSourcePackage; |
|
6 | 5 |
import org.eclipse.swt.widgets.Tree; |
7 | 6 |
import org.eclipse.swt.widgets.Widget; |
8 | 7 |
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; |
... | ... | |
15 | 14 |
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; |
16 | 15 |
|
17 | 16 |
public class SwtBotUtils { |
18 |
|
|
17 |
|
|
19 | 18 |
private SWTWorkbenchBot bot; |
20 |
|
|
19 |
|
|
21 | 20 |
public SwtBotUtils(SWTWorkbenchBot bot) { |
22 | 21 |
this.bot = bot; |
23 | 22 |
} |
24 |
|
|
23 |
|
|
25 | 24 |
/** |
26 | 25 |
* @return |
27 | 26 |
* @throws WidgetNotFoundException |
28 | 27 |
*/ |
29 | 28 |
public SWTBotTree tree(Widget widget) throws WidgetNotFoundException { |
30 | 29 |
List<Tree> controls = new ChildrenControlFinder(widget).findControls(WidgetMatcherFactory.widgetOfType(Tree.class)); |
31 |
if (controls.isEmpty()) |
|
32 |
throw new WidgetNotFoundException("Could not find any tree"); |
|
33 |
SWTBotTree tree = new SWTBotTree((Tree) controls.get(0)); |
|
30 |
if (controls.isEmpty()) { |
|
31 |
throw new WidgetNotFoundException("Could not find any tree"); |
|
32 |
} |
|
33 |
SWTBotTree tree = new SWTBotTree(controls.get(0)); |
|
34 | 34 |
return tree; |
35 | 35 |
} |
36 |
|
|
36 |
|
|
37 | 37 |
/** |
38 |
*
|
|
38 |
* |
|
39 | 39 |
* @param index the index of the SelectionElement |
40 | 40 |
* @param dialogName the title of the expected dialog |
41 | 41 |
*/ |
... | ... | |
52 | 52 |
public SWTBotView view(String title) throws WidgetNotFoundException { |
53 | 53 |
return getBot().viewByTitle(title); |
54 | 54 |
} |
55 |
|
|
55 |
|
|
56 | 56 |
public void cancel() { |
57 | 57 |
clickButton("Cancel"); |
58 | 58 |
} |
59 |
|
|
59 |
|
|
60 | 60 |
public void ok() { |
61 | 61 |
clickButton("OK"); |
62 | 62 |
} |
63 |
|
|
63 |
|
|
64 | 64 |
public void finish() { |
65 | 65 |
clickButton("Finish"); |
66 | 66 |
} |
67 |
|
|
67 |
|
|
68 | 68 |
public void clickButton(String label) { |
69 | 69 |
getBot().button(label).click(); |
70 | 70 |
} |
71 |
|
|
71 |
|
|
72 | 72 |
public String getActiveShellHeadline(){ |
73 | 73 |
return getBot().activeShell().getText(); |
74 | 74 |
} |
Also available in: Unified diff
dependency changes to move to e4