1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.eclipse.swtbot.swt.finder.resolvers; |
12 | |
|
13 | |
import java.util.ArrayList; |
14 | |
import java.util.List; |
15 | |
|
16 | |
import org.eclipse.swt.custom.CTabItem; |
17 | |
import org.eclipse.swt.widgets.Control; |
18 | |
import org.eclipse.swt.widgets.Widget; |
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | 5053 | public class CTabItemResolver implements IChildrenResolver, IParentResolver { |
27 | |
|
28 | |
public List getChildren(Widget w) { |
29 | 43 | ArrayList children = new ArrayList(); |
30 | 43 | Control control = ((CTabItem) w).getControl(); |
31 | 43 | if (control != null) |
32 | 43 | children.add(control); |
33 | 43 | return children; |
34 | |
} |
35 | |
|
36 | |
public boolean hasChildren(Widget w) { |
37 | 86 | return canResolve(w) && ((CTabItem) w).getControl() != null; |
38 | |
} |
39 | |
|
40 | |
public boolean canResolve(Widget w) { |
41 | 175 | return w instanceof CTabItem; |
42 | |
} |
43 | |
|
44 | |
public Class[] getResolvableClasses() { |
45 | 5053 | return new Class[] { CTabItem.class }; |
46 | |
} |
47 | |
|
48 | |
public Widget getParent(Widget w) { |
49 | 3 | return canResolve(w) ? ((CTabItem) w).getParent() : null; |
50 | |
} |
51 | |
|
52 | |
public boolean hasParent(Widget w) { |
53 | 2 | return getParent(w) != null; |
54 | |
} |
55 | |
|
56 | |
} |