| 1 | 2 | |
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
package org.eclipse.swtbot.swt.finder.waits; |
| 13 | |
|
| 14 | |
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; |
| 15 | |
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; |
| 16 | |
import org.eclipse.swtbot.swt.finder.results.BoolResult; |
| 17 | |
import org.eclipse.swtbot.swt.finder.utils.StringUtils; |
| 18 | |
import org.eclipse.swtbot.swt.finder.utils.internal.Assert; |
| 19 | |
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; |
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
class ShellIsActive extends DefaultCondition { |
| 30 | |
|
| 31 | |
private String text; |
| 32 | |
|
| 33 | 1 | ShellIsActive(String text) { |
| 34 | 1 | Assert.isNotNull(text, "The shell text was null"); |
| 35 | 1 | Assert.isLegal(!StringUtils.isEmpty(text), "The shell text was empty"); |
| 36 | 1 | this.text = text; |
| 37 | 1 | } |
| 38 | |
|
| 39 | |
public String getFailureMessage() { |
| 40 | 0 | return "The shell '" + text + "' did not activate"; |
| 41 | |
} |
| 42 | |
|
| 43 | |
public boolean test() throws Exception { |
| 44 | |
try { |
| 45 | 1 | final SWTBotShell shell = bot.shell(text); |
| 46 | 1 | return UIThreadRunnable.syncExec(new BoolResult() { |
| 47 | |
public Boolean run() { |
| 48 | 1 | return shell.widget.isVisible() || shell.widget.isFocusControl(); |
| 49 | |
} |
| 50 | |
}); |
| 51 | 0 | } catch (WidgetNotFoundException e) { |
| 52 | |
} |
| 53 | 0 | return false; |
| 54 | |
} |
| 55 | |
|
| 56 | |
} |