本文整理汇总了Java中org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot.waitUntil方法的典型用法代码示例。如果您正苦于以下问题:Java SWTWorkbenchBot.waitUntil方法的具体用法?Java SWTWorkbenchBot.waitUntil怎么用?Java SWTWorkbenchBot.waitUntil使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot
的用法示例。
在下文中一共展示了SWTWorkbenchBot.waitUntil方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
public static GW4EProject create (SWTWorkbenchBot bot,String gwproject) throws CoreException, FileNotFoundException {
GW4EProject project = new GW4EProject(bot, gwproject);
project.resetToJavPerspective();
project.createProject();
File path = new File("src/test/resources/petclinic");
IContainer destFolder = (IContainer) ResourceManager.getResource(gwproject+ "/src/test/resources");
ImportHelper.copyFiles(path,destFolder);
String[] folders = PreferenceManager.getAuthorizedFolderForGraphDefinition();
String[] temp = new String[2];
temp[0] = gwproject;
temp[1] = folders[1];
project.generateSource(temp);
bot.waitUntil(new EditorOpenedCondition(bot, "VeterinariensSharedStateImpl.java"), 3 * 60000);
project.waitForBuildAndAssertNoErrors();
return project;
}
示例2: openNewGraphWalkerModel
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
public static void openNewGraphWalkerModel(SWTWorkbenchBot bot) {
SWTBotMenu all = bot.menu("File").menu("New");
/*
Function<String, String> f = new Function<String, String> () {
@Override
public String apply(String t) {
return t;
}
};
all.menuItems().stream().map(f);
*/
bot.menu("File").menu("New").menu("GW4E Model").click();
bot.waitUntil(new ShellActiveCondition("GW4E"));
SWTBotShell shell = bot.shell("GW4E");
assertTrue(shell.isOpen());
shell.bot().button("Cancel").click();
bot.waitUntil(Conditions.shellCloses(shell));
}
示例3: waitUntilTreeItemHasChild
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Wait until a tree item contains a child with the given text.
*
* @throws TimeoutException if the child does not appear within the default timeout
*/
public static void waitUntilTreeItemHasChild(SWTWorkbenchBot bot, final SWTBotTreeItem treeItem,
final String childText) {
bot.waitUntil(new DefaultCondition() {
@Override
public String getFailureMessage() {
System.err.println(treeItem + ": expanded? " + treeItem.isExpanded());
for (SWTBotTreeItem childNode : treeItem.getItems()) {
System.err.println(" " + childNode);
}
return "Tree item never appeared";
}
@Override
public boolean test() throws Exception {
return treeItem.getNodes().contains(childText);
}
});
}
示例4: waitUntilTreeContainsText
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Wait until the tree item contains the given text with the timeout specified.
*/
public static void waitUntilTreeContainsText(SWTWorkbenchBot bot,
final SWTBotTreeItem treeItem,
final String text,
long timeout) {
bot.waitUntil(new DefaultCondition() {
@Override
public boolean test() throws Exception {
return treeItem.getText().contains(text);
}
@Override
public String getFailureMessage() {
return "Text never appeared";
}
}, timeout);
}
示例5: assertShellWithDataTypeVisible
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Tests if a shell with a specific type of data contained (e.g. Window).
*
* @param bot
* to use
* @param clazz
* class of data contained to check for
*/
@SuppressWarnings("rawtypes")
public static void assertShellWithDataTypeVisible(final SWTWorkbenchBot bot, final Class clazz) {
bot.waitUntil(Conditions.waitForShell(new BaseMatcher<Shell>() {
@SuppressWarnings("unchecked")
public boolean matches(final Object item) {
return UIThreadRunnable.syncExec(new Result<Boolean>() {
public Boolean run() {
if (item instanceof Shell) {
Object shellData = ((Shell) item).getData();
if (shellData != null) {
return clazz.isAssignableFrom(shellData.getClass());
}
}
return false;
}
});
}
public void describeTo(final Description description) {
description.appendText("Shell for " + clazz.getName());
}
}));
}
示例6: safeBlockingCollapse
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Waits until the node collapses.
*
* @param bot
* bot to work with, must not be {@code null}
* @param node
* node to wait for, must not be {@code null}
*/
public static void safeBlockingCollapse(final SWTWorkbenchBot bot, final SWTBotTreeItem node) {
Assert.isNotNull(bot, ARGUMENT_BOT);
Assert.isNotNull(node, ARGUMENT_NODE);
if (node.isExpanded()) {
node.collapse();
try {
bot.waitUntil(new DefaultCondition() {
@Override
@SuppressWarnings("PMD.JUnit4TestShouldUseTestAnnotation")
public boolean test() {
return !node.isExpanded();
}
@Override
public String getFailureMessage() {
return "Timeout for node to collapse";
}
}, TIMEOUT_FOR_NODE_TO_COLLAPSE_EXPAND);
} catch (TimeoutException e) {
// Try one last time and do not wait anymore
node.collapse();
}
}
}
示例7: setUp
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Pre flight initialization (run once for each test _case_)
*/
@Before
public void setUp() throws Exception {
// Force shell activation to counter, no active Shell when running SWTBot tests in Xvfb/Xvnc
// see https://wiki.eclipse.org/SWTBot/Troubleshooting#No_active_Shell_when_running_SWTBot_tests_in_Xvfb
Display.getDefault().syncExec(new Runnable() {
public void run() {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().forceActive();
}
});
bot = new SWTWorkbenchBot();
// Wait for the Toolbox shell to be available
final Matcher<Shell> withText = withText("TLA+ Toolbox");
bot.waitUntil(Conditions.waitForShell(withText), 30000);
// Wait for the Toolbox UI to be fully started.
final Matcher<MenuItem> withMnemonic = WidgetMatcherFactory.withMnemonic("File");
final Matcher<MenuItem> matcher = WidgetMatcherFactory.allOf(WidgetMatcherFactory.widgetOfType(MenuItem.class),
withMnemonic);
bot.waitUntil(Conditions.waitForMenu(bot.shell("TLA+ Toolbox"), matcher), 30000);
}
示例8: beforeClass
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
RCPTestSetupHelper.beforeClass();
// Force shell activation to counter, no active Shell when running SWTBot tests in Xvfb/Xvnc
// see https://wiki.eclipse.org/SWTBot/Troubleshooting#No_active_Shell_when_running_SWTBot_tests_in_Xvfb
Display.getDefault().syncExec(new Runnable() {
public void run() {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().forceActive();
}
});
bot = new SWTWorkbenchBot();
// Wait for the Toolbox shell to be available
final Matcher<Shell> withText = withText("TLA+ Toolbox");
bot.waitUntil(Conditions.waitForShell(withText), 30000);
// Wait for the Toolbox UI to be fully started.
final Matcher<MenuItem> withMnemonic = WidgetMatcherFactory.withMnemonic("File");
final Matcher<MenuItem> matcher = WidgetMatcherFactory.allOf(WidgetMatcherFactory.widgetOfType(MenuItem.class),
withMnemonic);
bot.waitUntil(Conditions.waitForMenu(bot.shell("TLA+ Toolbox"), matcher), 30000);
}
示例9: openPerspective
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
public static void openPerspective(SWTWorkbenchBot bot, String perspectiveLabel) {
SwtBotUtils.print("Opening Perspective: " + perspectiveLabel);
SWTBotShell shell = null;
try {
menu(bot, "Window").menu("Open Perspective").menu("Other...").click();
shell = bot.shell("Open Perspective");
bot.waitUntil(ActiveWidgetCondition.widgetMakeActive(shell));
shell.bot().table().select(perspectiveLabel);
shell.bot().button("OK").click();
bot.waitUntil(Conditions.shellCloses(shell));
} catch (Exception e) {
if (shell != null && shell.isOpen()) shell.close();
SwtBotUtils.printError("Couldn't open perspective '" + perspectiveLabel + "'\n"
+ "trying to activate already open perspective instead");
// maybe somehow the perspective is already opened (by another test before us)
SWTBotPerspective perspective = bot.perspectiveByLabel(perspectiveLabel);
perspective.activate();
}
SwtBotUtils.print("Opened Perspective: " + perspectiveLabel);
}
示例10: importProjectFromZip
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
public static void importProjectFromZip(SWTWorkbenchBot bot, String path) {
int timeout = 10000;
bot.menu("File").menu("Import...").click();
bot.waitUntil(Conditions.shellIsActive("Import"));
SWTBotShell shell = bot.shell("Import").activate();
shell.bot().tree().expandNode("General").select("Existing Projects into Workspace");
shell.bot().button("Next >").click();
shell.bot().radio("Select archive file:").click();
shell.bot().comboBox(1).setText(path);
shell.bot().comboBox(1).pressShortcut(SWT.CR, SWT.LF);
SWTBotButton finishButton = shell.bot().button("Finish");
ICondition buttonEnabled = new DefaultCondition() {
@Override
public boolean test() throws Exception {
return finishButton.isEnabled();
}
@Override
public String getFailureMessage() {
return "Finish button not enabled";
}
};
shell.bot().waitUntil(buttonEnabled, timeout);
finishButton.click();
bot.waitUntil(Conditions.shellCloses(shell), timeout);
}
示例11: waitUntilTreeHasItems
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Wait until the given tree has items, and return the first item.
*
* @throws TimeoutException if no items appear within the default timeout
*/
public static SWTBotTreeItem waitUntilTreeHasItems(SWTWorkbenchBot bot, final SWTBotTree tree) {
bot.waitUntil(new DefaultCondition() {
@Override
public String getFailureMessage() {
return "Tree items never appeared";
}
@Override
public boolean test() throws Exception {
return tree.hasItems();
}
});
return tree.getAllItems()[0];
}
示例12: waitUntilTreeHasNoItems
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Wait until the given tree has not items.
*
* @throws TimeoutException if no items appear within the default timeout
*/
public static void waitUntilTreeHasNoItems(SWTWorkbenchBot bot, final SWTBotTree tree) {
bot.waitUntil(new DefaultCondition() {
@Override
public String getFailureMessage() {
return "Tree items never disappeared";
}
@Override
public boolean test() throws Exception {
return !tree.hasItems();
}
});
}
示例13: safeBlockingExpand
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Waits until the node expands.
*
* @param bot
* bot to work with, must not be {@code null}
* @param node
* node to wait for, must not be {@code null}
*/
public static void safeBlockingExpand(final SWTWorkbenchBot bot, final SWTBotTreeItem node) {
Assert.isNotNull(bot, ARGUMENT_BOT);
Assert.isNotNull(node, ARGUMENT_NODE);
if (!node.isExpanded()) {
node.expand();
try {
bot.waitUntil(new DefaultCondition() {
@Override
@SuppressWarnings("PMD.JUnit4TestShouldUseTestAnnotation")
public boolean test() {
return node.isExpanded();
}
@Override
public String getFailureMessage() {
return "Timeout for node to expand";
}
}, TIMEOUT_FOR_NODE_TO_COLLAPSE_EXPAND);
} catch (TimeoutException e) {
// Try one last time and do not wait anymore
node.expand();
}
}
}
示例14: assertTextStyle
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Checks the given offset for the given {@link TextStyle}.
*
* @param editor
* the {@link XtextEditor}
* @param offset
* the position to check
* @param textStyle
* the expected {@link TextStyle}
* @param bot
* instance of swt bot
*/
public static void assertTextStyle(final XtextEditor editor, final int offset, final TextStyle textStyle, final SWTWorkbenchBot bot) {
bot.waitUntil(new DefaultCondition() {
@Override
public boolean test() {
return areEqualStyleRanges(createStyleRange(offset, 1, createTextAttribute(textStyle)), getStyleRange(editor, offset));
}
@Override
public String getFailureMessage() {
return STYLE_ASSERTION_FAILURE_MESSAGE;
}
});
}
示例15: waitForConsoleOutput
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
public static void waitForConsoleOutput(SWTWorkbenchBot bot, String string, long timeout) {
bot.waitUntil(waitForConsoleContains(string), timeout);
}