Java Code Examples for org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot#tree()
The following examples show how to use
org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot#tree() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CoreSwtbotTools.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * Open view. * * @param bot * to work with, must not be {@code null} * @param category * the category, must not be {@code null} * @param view * the name of the view, must not be {@code null} */ public static void openView(final SWTWorkbenchBot bot, final String category, final String view) { Assert.isNotNull(bot, ARGUMENT_BOT); Assert.isNotNull(category, "category"); Assert.isNotNull(view, ARGUMENT_VIEW); bot.menu("Window").menu("Show View").menu("Other...").click(); bot.shell("Show View").activate(); final SWTBotTree tree = bot.tree(); for (SWTBotTreeItem item : tree.getAllItems()) { if (category.equals(item.getText())) { CoreSwtbotTools.waitForItem(bot, item); final SWTBotTreeItem[] node = item.getItems(); for (SWTBotTreeItem swtBotTreeItem : node) { if (view.equals(swtBotTreeItem.getText())) { swtBotTreeItem.select(); } } } } assertTrue("View or Category found", bot.button().isEnabled()); bot.button("OK").click(); }
Example 2
Source File: SwtBotUtils.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
/** * Create a java project with the specified project name. This function opens up the Java * Perspective. * * @param bot The current SWTWorkbenchBot object * @param projectName Name of java project to be created */ public static void createJavaProject(SWTWorkbenchBot bot, String projectName) { // Open Java Perspective bot.perspectiveById("org.eclipse.jdt.ui.JavaPerspective").activate(); // Open the list of new project wizards bot.menu("File").menu("New").menu("Project...").click(); // Select the Java project SWTBotTree projectSelectionTree = bot.tree(); SWTBotTreeItem projectSelectionTreeItem = SwtBotTreeActions.getUniqueTreeItem(bot, projectSelectionTree, "Java", "Java Project"); SwtBotTreeActions.selectTreeItem(bot, projectSelectionTreeItem, "Java Project"); bot.button("Next >").click(); // Configure the project and then create it bot.textWithLabel("Project name:").setText(projectName); SwtBotUtils.clickButtonAndWaitForWindowChange(bot, bot.button("Finish")); }
Example 3
Source File: SwtBotProjectActions.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
/** * Creates a java project with the specified project name. * * @param bot the SWTWorkbenchBot * @param projectName the name of the java project to create */ public static void createJavaProject(SWTWorkbenchBot bot, String projectName) { // Open Java Perspective bot.perspectiveById("org.eclipse.jdt.ui.JavaPerspective").activate(); // Open the list of new project wizards bot.menu("File").menu("New").menu("Project...").click(); // Select the Java project SWTBotTree projectSelectionTree = bot.tree(); SWTBotTreeItem projectSelectionGoogleTreeItem = SwtBotTreeActions.getUniqueTreeItem(bot, projectSelectionTree, "Java", "Java Project"); SwtBotTreeActions.selectTreeItem(bot, projectSelectionGoogleTreeItem, "Java Project"); bot.button("Next >").click(); // Configure the project and then create it bot.textWithLabel("Project name:").setText(projectName); SwtBotUtils.clickButtonAndWaitForWindowChange(bot, bot.button("Finish")); }
Example 4
Source File: SwtBotProjectActions.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
public static void createUiBinder(final SWTWorkbenchBot bot, String projectName, String packageName, String name, boolean generateSampleContent, boolean generateComments) { // Open the list of new project wizards bot.menu("File").menu("New").menu("Other...").click(); // Select the Web App project wizard SWTBotTree projectSelectionTree = bot.tree(); SWTBotTreeItem projectSelectionGoogleTreeItem = SwtBotTreeActions .getUniqueTreeItem(bot, projectSelectionTree, "GWT Classes", "UiBinder").expand(); SwtBotTreeActions.selectTreeItem(bot, projectSelectionGoogleTreeItem, "UiBinder"); bot.button("Next >").click(); // Configure the UiBinder and then create it String sourceFolder = projectName + "/" + SOURCE_FOLDER; bot.textWithLabel("Source folder:").setText(sourceFolder); bot.textWithLabel("Package:").setText(packageName); bot.textWithLabel("Name:").setText(name); SwtBotUtils.setCheckBox(bot.checkBox("Generate sample content"), generateSampleContent); SwtBotUtils.setCheckBox(bot.checkBox("Generate comments"), generateComments); SwtBotUtils.clickButtonAndWaitForWindowChange(bot, bot.button("Finish")); }
Example 5
Source File: SwtBotMenuActions.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
public static void openNewMavenProject(SWTWorkbenchBot bot) { openNewOtherProjectDialog(bot); // filter maven options bot.text().setText("maven"); bot.sleep(500); // click on Maven Project SWTBotTree tree = bot.tree(); SWTBotTreeItem[] items = tree.getAllItems(); SwtBotTreeActions.selectTreeItem(bot, items[0], "Maven Project"); // move to next step bot.button("Next >").click(); }
Example 6
Source File: SwtBotProjectActions.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
public static void createWebAppProject(final SWTWorkbenchBot bot, String projectName, String packageName, boolean useGwt, boolean generateSampleCode) { // Open Java Perspective bot.perspectiveById("org.eclipse.jdt.ui.JavaPerspective").activate(); // Open the list of new project wizards bot.menu("File").menu("New").menu("Project...").click(); // Select the Web App project wizard SWTBotTree projectSelectionTree = bot.tree(); // GWT Application SWTBotTreeItem projectSelectionTreeItem = SwtBotTreeActions.getUniqueTreeItem(bot, projectSelectionTree, "GWT Application", "GWT Web Application Project").expand(); SwtBotTreeActions.selectTreeItem(bot, projectSelectionTreeItem, "GWT Web Application Project"); bot.button("Next >").click(); // Configure the project and then create it bot.textWithLabel("Project name:").setText(projectName); bot.textWithLabel("Package: (e.g. com.example.myproject)").setText(packageName); SwtBotUtils.setCheckBox(bot.checkBox("Use GWT"), useGwt); SwtBotUtils.setCheckBox(bot.checkBox("Generate project sample code"), generateSampleCode); SwtBotUtils.clickButtonAndWaitForWindowChange(bot, bot.button("Finish")); SwtBotWorkbenchActions.waitForIdle(bot); }