1 package eu
.etaxonomy
.taxeditor
.test
;
5 import org
.eclipse
.osgi
.internal
.loader
.FilteredSourcePackage
;
6 import org
.eclipse
.swt
.widgets
.Tree
;
7 import org
.eclipse
.swt
.widgets
.Widget
;
8 import org
.eclipse
.swtbot
.eclipse
.finder
.SWTWorkbenchBot
;
9 import org
.eclipse
.swtbot
.eclipse
.finder
.matchers
.WidgetMatcherFactory
;
10 import org
.eclipse
.swtbot
.eclipse
.finder
.waits
.Conditions
;
11 import org
.eclipse
.swtbot
.eclipse
.finder
.widgets
.SWTBotView
;
12 import org
.eclipse
.swtbot
.swt
.finder
.exceptions
.WidgetNotFoundException
;
13 import org
.eclipse
.swtbot
.swt
.finder
.finders
.ChildrenControlFinder
;
14 import org
.eclipse
.swtbot
.swt
.finder
.widgets
.SWTBotButton
;
15 import org
.eclipse
.swtbot
.swt
.finder
.widgets
.SWTBotTree
;
17 public class SwtBotUtils
{
19 private SWTWorkbenchBot bot
;
21 public SwtBotUtils(SWTWorkbenchBot bot
) {
27 * @throws WidgetNotFoundException
29 public SWTBotTree
tree(Widget widget
) throws WidgetNotFoundException
{
30 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));
39 * @param index the index of the SelectionElement
40 * @param dialogName the title of the expected dialog
42 public void openFilteredSelection(int index
, String dialogName
){
43 SWTBotButton existing
= bot
.buttonWithTooltip("Browse existing", index
);
45 bot
.waitUntil(Conditions
.shellIsActive(dialogName
));
50 * @throws WidgetNotFoundException
52 public SWTBotView
view(String title
) throws WidgetNotFoundException
{
53 return getBot().viewByTitle(title
);
56 public void cancel() {
57 clickButton("Cancel");
64 public void finish() {
65 clickButton("Finish");
68 public void clickButton(String label
) {
69 getBot().button(label
).click();
72 public String
getActiveShellHeadline(){
73 return getBot().activeShell().getText();
76 public SWTWorkbenchBot
getBot() {
80 public void setBot(SWTWorkbenchBot bot
) {