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.widgets.TabItem; |
17 | |
import org.eclipse.swt.widgets.Widget; |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | 5053 | public class TabItemResolver implements IChildrenResolver, IParentResolver { |
24 | |
|
25 | |
public boolean canResolve(Widget w) { |
26 | 122831 | return w instanceof TabItem; |
27 | |
} |
28 | |
|
29 | |
public List getChildren(Widget w) { |
30 | 30401 | ArrayList children = new ArrayList(); |
31 | 30401 | children.add(((TabItem) w).getControl()); |
32 | 30401 | return children; |
33 | |
} |
34 | |
|
35 | |
public Widget getParent(Widget w) { |
36 | 1227 | return (canResolve(w)) ? ((TabItem) w).getParent() : null; |
37 | |
} |
38 | |
|
39 | |
public Class[] getResolvableClasses() { |
40 | 5053 | return new Class[] { TabItem.class }; |
41 | |
} |
42 | |
|
43 | |
public boolean hasChildren(Widget w) { |
44 | 60802 | return (canResolve(w)) && ((TabItem) w).getControl() != null; |
45 | |
} |
46 | |
|
47 | |
public boolean hasParent(Widget w) { |
48 | 818 | return getParent(w) != null; |
49 | |
} |
50 | |
|
51 | |
} |