public static void createJavaProject(IUIContext ui, String projectName) throws WidgetSearchException { ensureNotNull(ui, projectName); try { TypingLinuxHelper.switchToInsertStrategyIfNeeded(); ui.click(new MenuItemLocator("File/New/Project...")); ui.wait(new ShellShowingCondition("New Project")); ui.click(new TreeItemLocator("Java/Java Project")); ui.click(new ButtonLocator("Next >")); ui.assertThat(new IsEnabledCondition(new ButtonLocator("Finish"), false)); // new DebugHelper().printWidgets(); // WidgetPrinter printer = new WidgetPrinter(); // DisplayReference.getDefault().getActiveShell().accept(printer); // System.out.println(printer.asString()); // Assert.fail(); ui.click(new LabeledTextLocator("&Project name:")); ui.enterText(projectName); ui.assertThat(new IsEnabledCondition(new ButtonLocator("Finish"), true)); ui.click(new ButtonLocator(SEP_SRC_FOLDER_CREATION_LABEL)); ui.click(new ButtonLocator("Finish")); ui.wait(new ShellDisposedCondition("New Java Project")); ui.wait(new JobsCompleteCondition()); ui.wait(new SWTIdleCondition()); } finally { TypingLinuxHelper.restoreOriginalStrategy(); } }
// NOTE: assumes target project is selected... public static void createJavaClass(IUIContext ui, String sourceFolder, String className) throws WidgetSearchException { try { TypingLinuxHelper.switchToInsertStrategyIfNeeded(); ensureNotNull(ui, className); ui.click(new MenuItemLocator("File/New/Class")); ui.wait(new ShellShowingCondition("New Java Class")); ui.click(2, new LabeledTextLocator("Source fol&der:")); ui.enterText(sourceFolder); ui.click(2, new LabeledTextLocator("Na&me:")); ui.enterText(className); ui.assertThat(new ButtonLocator("Finish").isEnabled()); ui.click(new ButtonLocator("Finish")); ui.wait(new ShellDisposedCondition("New Java Class")); } finally { TypingLinuxHelper.restoreOriginalStrategy(); } }
/** Main test method. */ public void testtestSimpleJavaProjectCreation() throws Exception { IUIContext ui = getUI(); ui.click(new MenuItemLocator("File/New/Project...")); ui.wait(new ShellShowingCondition("New Project")); ui.click( new FilteredTreeItemLocator( "Java Project")); // ? https://fogbugz.instantiations.com/default.php?44689 ui.click(new FilteredTreeItemLocator("Java/Java Project")); ui.click(new ButtonLocator("&Next >")); ui.enterText("JP2"); ui.click(new ButtonLocator("&Finish")); ui.wait(new ShellDisposedCondition("New Java Project")); }