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.Arrays; |
15 | |
import java.util.List; |
16 | |
|
17 | |
import org.eclipse.swt.widgets.ExpandBar; |
18 | |
import org.eclipse.swt.widgets.Widget; |
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | 5053 | public class ExpandBarResolver implements IChildrenResolver, IParentResolver { |
24 | |
|
25 | |
public boolean canResolve(Widget w) { |
26 | 100 | return w instanceof ExpandBar; |
27 | |
} |
28 | |
|
29 | |
public List getChildren(Widget w) { |
30 | 20 | return hasChildren(w) ? Arrays.asList(((ExpandBar) w).getItems()) : new ArrayList(); |
31 | |
} |
32 | |
|
33 | |
public Widget getParent(Widget w) { |
34 | 0 | return canResolve(w) ? ((ExpandBar) w).getParent() : null; |
35 | |
} |
36 | |
|
37 | |
public Class[] getResolvableClasses() { |
38 | 5053 | return new Class[] { ExpandBar.class }; |
39 | |
} |
40 | |
|
41 | |
public boolean hasChildren(Widget w) { |
42 | 60 | return canResolve(w) && ((ExpandBar) w).getItems().length > 0; |
43 | |
} |
44 | |
|
45 | |
public boolean hasParent(Widget w) { |
46 | 0 | return getParent(w) != null; |
47 | |
} |
48 | |
|
49 | |
} |