4 package eu
.etaxonomy
.taxeditor
.test
;
8 import org
.eclipse
.swt
.widgets
.Tree
;
9 import org
.eclipse
.swt
.widgets
.Widget
;
10 import org
.eclipse
.swtbot
.eclipse
.finder
.SWTWorkbenchBot
;
11 import org
.eclipse
.swtbot
.eclipse
.finder
.matchers
.WidgetMatcherFactory
;
12 import org
.eclipse
.swtbot
.eclipse
.finder
.waits
.Conditions
;
13 import org
.eclipse
.swtbot
.eclipse
.finder
.widgets
.SWTBotView
;
14 import org
.eclipse
.swtbot
.swt
.finder
.exceptions
.WidgetNotFoundException
;
15 import org
.eclipse
.swtbot
.swt
.finder
.finders
.ChildrenControlFinder
;
16 import org
.eclipse
.swtbot
.swt
.finder
.junit
.SWTBotJunit4ClassRunner
;
17 import org
.eclipse
.swtbot
.swt
.finder
.utils
.SWTBotPreferences
;
18 import org
.eclipse
.swtbot
.swt
.finder
.widgets
.SWTBotTree
;
19 import org
.junit
.Before
;
20 import org
.junit
.runner
.RunWith
;
26 @RunWith(SWTBotJunit4ClassRunner
.class)
27 public abstract class AbstractEditorTest
{
29 protected SWTWorkbenchBot bot
;
33 bot
= new SWTWorkbenchBot();
34 SWTBotPreferences
.TIMEOUT
= 300000;
36 String activeText
= bot
.activeShell().getText();
37 if(activeText
.equals("Connecting to datasource: cdm")){
38 bot
.waitUntil(Conditions
.shellIsActive("Login"));
39 bot
.button("Cancel").click();
46 * @throws WidgetNotFoundException
48 public SWTBotTree
tree(Widget widget
) throws WidgetNotFoundException
{
49 List
<Tree
> controls
= new ChildrenControlFinder(widget
).findControls(WidgetMatcherFactory
.widgetOfType(Tree
.class));
50 if (controls
.isEmpty())
51 throw new WidgetNotFoundException("Could not find any tree");
52 SWTBotTree tree
= new SWTBotTree((Tree
) controls
.get(0));
58 * @throws WidgetNotFoundException
60 public SWTBotView
view(String title
) throws WidgetNotFoundException
{
61 return bot
.viewByTitle(title
);
64 public void cancel() {
65 clickButton("Cancel");
72 public void clickButton(String label
) {
73 bot
.button(label
).click();