Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
WaitForShellInParent |
|
| 1.0;1 | ||||
WaitForShellInParent$1 |
|
| 1.0;1 |
1 | 0 | /******************************************************************************* |
2 | * Copyright (c) 2008 SWTBot contributors and others. | |
3 | * All rights reserved. This program and the accompanying materials | |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | * | |
8 | * Contributors: | |
9 | * Ketan Patel - initial API and implementation | |
10 | * (https://bugs.eclipse.org/bugs/show_bug.cgi?id=259837) | |
11 | * Ketan Padegaonkar - modification to initial implementation | |
12 | *******************************************************************************/ | |
13 | package org.eclipse.swtbot.swt.finder.waits; | |
14 | ||
15 | import org.eclipse.swt.widgets.Shell; | |
16 | import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; | |
17 | import org.eclipse.swtbot.swt.finder.results.ArrayResult; | |
18 | import org.hamcrest.Matcher; | |
19 | ||
20 | /** | |
21 | * A contdition that waits until a shell matching the matcher appears in the parent shell. | |
22 | * | |
23 | * @see Conditions | |
24 | * @author Ketan Patel <ktp420@live.com> | |
25 | * @author Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com> | |
26 | * @version $Id$ | |
27 | */ | |
28 | class WaitForShellInParent extends WaitForShell { | |
29 | 0 | private final Shell parent; |
30 | ||
31 | WaitForShellInParent(Shell parent, Matcher<Shell> matcher) { | |
32 | 0 | super(matcher); |
33 | 0 | this.parent = parent; |
34 | 0 | } |
35 | ||
36 | protected Shell[] findShells() { | |
37 | 0 | return UIThreadRunnable.syncExec(new ArrayResult<Shell>() { |
38 | public Shell[] run() { | |
39 | 0 | return parent.getShells(); |
40 | } | |
41 | }); | |
42 | } | |
43 | ||
44 | } |