Java Code Examples for org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot#button()

The following examples show how to use org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot#button() . 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: SwtBotSdkActions.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private static void setupSdk(final SWTWorkbenchBot bot, String treeItemText,
    String sdkDirEnvVariableName, String sdkDisplayName) {
  SwtBotWorkbenchActions.openPreferencesDialog(bot);

  SWTBotTreeItem prefGwtTreeItem =
      SwtBotTreeActions.getUniqueTreeItem(bot, bot.tree(),
          SwtBotProjectActions.GWT_MENU_LABELS, "GWT Settings").expand();
  SwtBotTreeActions.selectTreeItem(bot, prefGwtTreeItem, treeItemText);

  SwtBotUtils.clickButtonAndWaitForWindowChange(bot, bot.button("Add..."));

  // Remove, use the included sdks
  bot.textWithLabel("Installation directory:").setText(System.getenv(sdkDirEnvVariableName));
  bot.textWithLabel("Display name:").setText(sdkDisplayName);

  SWTBotButton okButton = bot.button("OK");
  if (okButton.isEnabled()) {
    // Close add SDK dialog
    SwtBotUtils.clickButtonAndWaitForWindowChange(bot, okButton);
  } else {
    // Already setup, in the case of running multiple tests together
    SwtBotUtils.clickButtonAndWaitForWindowChange(bot, bot.button("Cancel"));
  }

  // Close Preferences dialog
  SwtBotUtils.clickButtonAndWaitForWindowChange(bot, bot.button("OK"));
}