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