Commit | Line | Data |
---|---|---|
4b451cbe MK |
1 | /******************************************************************************* |
2 | * Copyright (c) 2013 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Matthew Khouzam - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.tmf.ui.swtbot.tests.conditions; | |
14 | ||
15 | import org.eclipse.jface.wizard.IWizardPage; | |
16 | import org.eclipse.jface.wizard.Wizard; | |
17 | import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; | |
18 | import org.eclipse.swtbot.swt.finder.waits.ICondition; | |
693ec829 | 19 | import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable; |
4b451cbe MK |
20 | import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; |
21 | import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; | |
22 | ||
23 | /** | |
24 | * Is a tree node available | |
25 | * | |
26 | * @author Matthew Khouzam | |
27 | */ | |
28 | public abstract class ConditionHelpers { | |
29 | ||
30 | /** | |
31 | * Is a tree node available | |
32 | * | |
33 | * @param name | |
34 | * the name of the node | |
35 | * @param tree | |
36 | * the parent tree | |
37 | * @return true or false, it should swallow all exceptions | |
38 | */ | |
39 | public static ICondition IsTreeNodeAvailable(String name, SWTBotTree tree) { | |
40 | return new TreeNodeAvailable(name, tree); | |
41 | } | |
42 | ||
43 | /** | |
44 | * Is the treeItem's node available | |
45 | * | |
46 | * @param name | |
47 | * the name of the node | |
48 | * @param treeItem | |
49 | * the treeItem | |
50 | * @return true or false, it should swallow all exceptions | |
51 | */ | |
52 | public static ICondition IsTreeChildNodeAvailable(String name, SWTBotTreeItem treeItem) { | |
53 | return new TreeItemNodeAvailable(name, treeItem); | |
54 | } | |
55 | ||
56 | /** | |
57 | * Checks if the wizard's shell is null | |
58 | * | |
59 | * @param wizard | |
60 | * the null | |
61 | * @return false if either are null | |
62 | */ | |
63 | public static ICondition isWizardReady(Wizard wizard) { | |
64 | return new WizardReady(wizard); | |
65 | } | |
66 | ||
67 | /** | |
68 | * Is the wizard on the page you want? | |
69 | * | |
70 | * @param wizard | |
71 | * wizard | |
72 | * @param desiredPage | |
73 | * the desired page | |
74 | * @return true or false | |
75 | */ | |
76 | public static ICondition isWizardOnPage(Wizard wizard, IWizardPage desiredPage) { | |
77 | return new WizardOnPage(wizard, desiredPage); | |
78 | } | |
79 | ||
80 | /** | |
81 | * Wait for a view to close | |
82 | * | |
83 | * @param view | |
84 | * bot view for the view | |
85 | * @return true if the view is closed, false if it's active. | |
86 | */ | |
87 | public static ICondition ViewIsClosed(SWTBotView view) { | |
88 | return new ViewClosed(view); | |
89 | } | |
693ec829 BH |
90 | |
91 | /** | |
92 | * Wait till table cell has a given content. | |
93 | * | |
94 | * @param table | |
95 | * the table bot reference | |
96 | * @param content | |
97 | * the content to check | |
98 | * @param row | |
99 | * the row of the cell | |
100 | * @param column | |
101 | * the column of the cell | |
102 | * @return ICondition for verification | |
103 | */ | |
104 | public static ICondition isTableCellFilled(SWTBotTable table, String content, int row, int column) { | |
105 | return new TableCellFilled(table, content, row, column); | |
106 | } | |
4b451cbe | 107 | } |