本文整理汇总了Java中org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot.shell方法的典型用法代码示例。如果您正苦于以下问题:Java SWTWorkbenchBot.shell方法的具体用法?Java SWTWorkbenchBot.shell怎么用?Java SWTWorkbenchBot.shell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot
的用法示例。
在下文中一共展示了SWTWorkbenchBot.shell方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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));
}
示例2: openImportProjectsWizard
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
private static void openImportProjectsWizard(SWTWorkbenchBot bot,
String wizardCategory, String importWizardName) {
for (int tries = 1; true; tries++) {
SWTBotShell shell = null;
try {
bot.menu("File").menu("Import...").click();
shell = bot.shell("Import");
shell.activate();
SwtBotTreeUtilities.waitUntilTreeHasItems(bot, bot.tree());
SWTBotTreeItem treeItem = bot.tree().expandNode(wizardCategory);
SwtBotTreeUtilities.waitUntilTreeItemHasChild(bot, treeItem, importWizardName);
treeItem.select(importWizardName);
break;
} catch (TimeoutException e) {
if (tries == 2) {
throw e;
} else if (shell != null) {
shell.close();
}
}
}
}
示例3: 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);
}
示例4: handleCreationWizard
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* @param bot
*/
public static void handleCreationWizard(SWTWorkbenchBot bot) {
bot.activeShell().bot().button(Properties.BUTTON_NEXT).click();
bot.textWithLabel(TEXT_WITH_LABEL_ENDPOINT_NAME).setText(ENDPOINT_NAME);
bot.activeShell().bot().link()
.click(IMAGE_HYPER_LINK_CREATE_NEW_PROJECT);
SWTBotShell shell = bot.shell(Properties.SHELL_EMPTY_STRING);
shell.activate();
bot.button(Properties.BUTTON_NEXT).click();
bot.textWithLabel(Properties.TEXT_WITH_LABEL_PROJECT_NAME).setText(
PropertiesESB.ARTIFACT_MY_ESB_CONFIG_PROJECT_FOR_ENDPOINT_TEST);
bot.button(Properties.BUTTON_FINISH).click();
bot.textWithLabel(Properties.TEXT_WITH_LABEL_Address).setText(
PropertiesESB.ARTIFACT_ENDPOINT_URL);
bot.button(Properties.BUTTON_FINISH).click();
}
示例5: beforeClass
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
bot = new SWTWorkbenchBot();
try {
bot.viewByTitle("Welcome").close();
} catch (WidgetNotFoundException e) {
// OK, no Welcome view, that's fine :)
}
// Change the perspective via the Open Perspective dialog
bot.menu("Window").menu("Open Perspective").menu("Other...").click();
SWTBotShell openPerspectiveShell = bot.shell("Open Perspective");
openPerspectiveShell.activate();
// select the dialog
bot.table().select("Plug-in Development");
bot.button("OK").click();
// in Luna the Error Log is not shown by default in the Plug-in Development perspective
// bot.viewByPartName("Error Log").close();
// in SwtBot 2.2.0 we must use viewByPartName instead of viewByTitle
bot.viewByPartName("Problems").show();
}
开发者ID:LorenzoBettini,项目名称:packtpub-xtext-book-examples,代码行数:25,代码来源:SmallJavaProjectWizardTests.java
示例6: createMavenProject
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Create a Maven project based on an archetype.
*/
public static IProject createMavenProject(final SWTWorkbenchBot bot, String groupId,
String artifactId, String archetypeGroupId, String archetypeArtifactId,
String archetypeVersion, String archetypeUrl, String javaPackage) {
bot.menu("File").menu("New").menu("Project...").click();
SWTBotShell shell = bot.shell("New Project");
shell.activate();
bot.tree().expandNode("Maven").select("Maven Project");
bot.button("Next >").click();
// we want to specify an archetype
bot.checkBox("Create a simple project (skip archetype selection)").deselect();
bot.button("Next >").click();
// open archetype dialog
SwtBotTestingUtilities.clickButtonAndWaitForWindowChange(bot, bot.button("Add Archetype..."));
bot.comboBox(0).setText(archetypeGroupId);
bot.comboBox(1).setText(archetypeArtifactId);
bot.comboBox(2).setText(archetypeVersion);
bot.comboBox(3).setText(archetypeUrl);
// close archetype dialog
// After OK, it will take a minute to download
SwtBotTestingUtilities.clickButtonAndWaitForWindowChange(bot, bot.button("OK"));
// move to last wizard
bot.button("Next >").click();
// set archetype inputs
bot.comboBoxWithLabel("Group Id:").setText(groupId);
bot.comboBoxWithLabel("Artifact Id:").setText(artifactId);
bot.comboBoxWithLabel("Package:").setText(javaPackage);
SwtBotTestingUtilities.clickButtonAndWaitForWindowClose(bot, bot.button("Finish"));
return getWorkspaceRoot().getProject("testartifact");
}
示例7: checkOpenWindow
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Returns {@code true} if the SWTBot finds the specified window.
*
* @param bot
* the {@link SWTWorkbenchBot}, must not be {@code null}
* @param windowName
* the name of the window to search for, must not be {@code null}
* @return {@code true} if a window was found, {@code false} otherwise
*/
public static boolean checkOpenWindow(final SWTWorkbenchBot bot, final String windowName) {
Assert.isNotNull(bot, ARGUMENT_BOT);
Assert.isNotNull(windowName, "windowName");
Boolean windowFound = false;
try {
final SWTBotShell shell = bot.shell(windowName);
shell.isActive();
windowFound = true;
} catch (WidgetNotFoundException exception) {
throw new WrappedException("Error during searching for window", exception);
}
return windowFound;
}
示例8: switchPerspective
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Switching to a new Perspective.
*
* @param bot
* to work with, must not be {@code null}
* @param perspective
* the new perspective to open, must not be {@code null}
*/
public static void switchPerspective(final SWTWorkbenchBot bot, final String perspective) {
Assert.isNotNull(bot, ARGUMENT_BOT);
Assert.isNotNull(perspective, "perspective");
// Change the perspective via the Open Perspective dialog
bot.menu("Window").menu("Open Perspective").menu("Other...").click();
final SWTBotShell shell = bot.shell("Open Perspective");
shell.activate();
// select the dialog
bot.table().select(perspective);
bot.button("OK").click();
}
示例9: openAvaloqPreferencesSection
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Open a specific Avaloq Prefrences Page.
*
* @param bot
* to work with, must not be {@code null}
* @param section
* the name of the desired page (e.g. 'Database'), must not be {@code null}
*/
public static void openAvaloqPreferencesSection(final SWTWorkbenchBot bot, final String section) {
Assert.isNotNull(bot, ARGUMENT_BOT);
Assert.isNotNull(section, "section");
bot.menu("Window").menu("Preferences").click();
final SWTBotShell shell = bot.shell("Preferences");
shell.activate();
final SWTBotTreeItem item = bot.tree().getTreeItem("Avaloq");
CoreSwtbotTools.waitForItem(bot, item);
CoreSwtbotTools.expandNode(bot.tree(), "Avaloq").select(section);
}
示例10: createWebAppProject
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
public static IProject createWebAppProject(SWTWorkbenchBot bot, String projectName,
String location, String javaPackage, AppEngineRuntime runtime, Runnable extraBotActions) {
bot.menu("File").menu("New").menu("Project...").click();
SWTBotShell shell = bot.shell("New Project");
shell.activate();
SwtBotTreeUtilities.waitUntilTreeHasItems(bot, bot.tree());
bot.tree().expandNode("Google Cloud Platform")
.select("Google App Engine Standard Java Project");
bot.button("Next >").click();
if (extraBotActions != null) {
extraBotActions.run();
}
bot.textWithLabel("Project name:").setText(projectName);
if (location == null) {
bot.checkBox("Use default location").select();
} else {
bot.checkBox("Use default location").deselect();
bot.textWithLabel("Location:").setText(location);
}
if (javaPackage != null) {
bot.textWithLabel("Java package:").setText(javaPackage);
}
if (runtime != null) {
if (runtime == AppEngineRuntime.STANDARD_JAVA_7) {
bot.comboBoxWithLabel("Java version:").setSelection("Java 7, Servlet 2.5");
} else if (runtime == AppEngineRuntime.STANDARD_JAVA_8) {
bot.comboBoxWithLabel("Java version:").setSelection("Java 8, Servlet 3.1");
} else {
Assert.fail("Runtime not handled: " + runtime);
}
}
// can take a loooong time to resolve jars (e.g. servlet-api.jar) from Maven Central
int libraryResolutionTimeout = 300 * 1000/* ms */;
SwtBotTimeoutManager.setTimeout(libraryResolutionTimeout);
try {
SwtBotTestingUtilities.clickButtonAndWaitForWindowClose(bot, bot.button("Finish"));
} catch (TimeoutException ex) {
System.err.println("FATAL: timed out while waiting for the wizard to close. Forcibly killing "
+ "all shells: https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/1925");
System.err.println("FATAL: You will see tons of related errors: \"Widget is disposed\", "
+ "\"Failed to execute runnable\", \"IllegalStateException\", etc.");
SwtBotWorkbenchActions.killAllShells(bot);
throw ex;
}
SwtBotTimeoutManager.resetTimeout();
IProject project = waitUntilFacetedProjectExists(bot, getWorkspaceRoot().getProject(projectName));
SwtBotWorkbenchActions.waitForProjects(bot, project);
return project;
}
示例11: openNewGW4EProject
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
public static void openNewGW4EProject(SWTWorkbenchBot bot) {
bot.menu("File").menu("New").menu("GW4E Project").click();
bot.waitUntil(new ShellActiveCondition("GW4E Project Creation Wizard"));
SWTBotShell shell = bot.shell("GW4E Project Creation Wizard");
assertTrue(shell.isOpen());
shell.bot().button("Cancel").click();
bot.waitUntil(Conditions.shellCloses(shell));
}